public bool update(string name, float money)
{//存入,修改储户余额
bool boo = false;
float mm = this.GetMoney(name) + money;
string up = "update CARD set [Amount]='" + mm + "' where Card_number='" + name + "'";
SqlConnection con = this.getCon();
try
{
SqlCommand com = new SqlCommand(up, con);
con.Open();
com.ExecuteNoQuery();//这里出错?错在哪里啊?
boo = true;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
con.Close();
}
return boo;
}错误 10 “System.Data.SqlClient.SqlCommand”不包含“ExecuteNoQuery”的定义,并且找不到可接受类型为“System.Data.SqlClient.SqlCommand”的第一个参数的扩展方法“ExecuteNoQuery”(是否缺少 using 指令或程序集引用?) D:\SHUJU\bank\bank\Dao.cs 143 21 bank
ExecuteNonQuery
属于编写错误。怎么出现这样的错误,VS不都是有智能提示吗
眼神真好使。
我還想說輸出SQL看看呢。。