SqlCommand cmd = new SqlCommand("select (select isnull(sum(totalquantity),0) from c_inv_transaction where item_id =" + str + " and lot_No ='" + text + "' and transactionType = 'IN') - (select isnull(sum(totalquantity),0) from c_inv_transaction where item_id =" + str + " and lot_No ='" + text + "' and transactionType = 'OUT') as aa");this.label4.Text = (string)cmd.ExecuteScalar();
2 回答
HUX布斯
TA贡献1876条经验 获得超6个赞
SqlConnection con=new SqlConnection(连接字符串);
string sql="select (select isnull(sum(totalquantity),0) from c_inv_transaction where item_id =" + str + " and lot_No ='" + text + "' and transactionType = 'IN') - (select isnull(sum(totalquantity),0) from c_inv_transaction where item_id =" + str + " and lot_No ='" + text + "' and transactionType = 'OUT') as aa";
SqlCommand cmd = new SqlCommand(sql,con) //这里的con你没有
添加回答
举报
0/150
提交
取消