我的代码遇到了一些问题.
这是我的数据库类中的方法
public void editproduct(string a, int b, int c)
{
conn.Open();
SqlCommand command = new SqlCommand("UPDATE Productdescription SET pdescription = '" + a + "',Price = " + b + " WHERE pid = " + c + ")", conn);
command.ExecuteNonQuery();
conn.Close();
}
Run Code Online (Sandbox Code Playgroud)
我尝试用我的按钮在这里执行它.
private void button1_Click(object sender, EventArgs e)
{
Database db = new Database();
db.editproduct(textBox1.Text, Convert.ToInt32(textBox2.Text), Convert.ToInt32(textBox3.Text));
}
Run Code Online (Sandbox Code Playgroud)
但我得到这个错误::
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box. …Run Code Online (Sandbox Code Playgroud)