我收到此错误:
参数化查询“(@SupplierName nvarchar(50),@CostPrice nvarchar(50))UPDATE CostP”需要未提供的参数“@SupplierName”。
这里有什么问题?
con = new System.Data.SqlClient.SqlConnection();
con.ConnectionString = "Data Source=tcp:SHEN-PC,49172\\SQLEXPRESS;Initial Catalog=LSEStock;Integrated Security=True";
con.Open();
String updateData = "UPDATE CostPrice SET SupplierName = @SupplierName, CostPrice = @CostPrice WHERE PartsID = '" +textBox1.Text+"'";
SqlCommand update = new SqlCommand(updateData, con);
update.Parameters.Add("@SupplierName", SqlDbType.NVarChar, 50, "SupplierName");
update.Parameters.Add("@CostPrice", SqlDbType.NVarChar, 50, "CostPrice");
update.ExecuteNonQuery();