我试图使用c#从mysql表中获取特定项目的数量。但是我什么都没有
我的代码
string Batch = textBox8.Text;
string batchnumber = ("SELECT COUNT [Batch_No] FROM Orders where Batch_No='" + Batch + "'");
订单是我的表,batch_no是列,我想得到表中特定批号的计数。我该怎么办?
答案 0 :(得分:0)
将COUNT [Batch_No]
更改为COUNT(Batch_No)
。它会起作用。
试试这个:
string Batch = textBox8.Text;
string batchnumber = ("SELECT COUNT(Batch_No) FROM Orders WHERE Batch_No='" + Batch + "'");