我有以下代码。获取查询的int值
string connStr = String.Format("server=localhost;user id=root; password=1234;" + "database=Printermangement; pooling=false", "localhost", "root", "1234");
string Query = "select sum(Page_Printed) from printjobdetails where User_ID = 'MyProperty'GROUP by User_ID";
MySqlConnection conDataBase = new MySqlConnection(connStr);
MySqlCommand cmdDataBase = new MySqlCommand(Query, conDataBase);
MessageBox.Show(Query);
我想从这个查询sum
,但我无法弄清楚如何获得int
值在消息框中显示。我怎样才能做到这一点?
'MessageBox.Show(Query);'显示查询,而不是结果。 –