I am new in SQL and C# and I encountered this SQL error.
The parameterized query '(@pid nvarchar(4000),@desc nvarchar(4000),@cat nvarchar(4000),@p' expects the parameter '@pid', which was not supplied.
I really need help. Thanks!
public void InsertRecord()
{
SqlCommand cmd = new SqlCommand("INSERT INTO PRODUCTS VALUES (@pid, @desc, @cat, @price, @scode)", myCon);
cmd.Parameters.AddWithValue("@pid", productID);
cmd.Parameters.AddWithValue("@desc", description);
cmd.Parameters.AddWithValue("@cat", category);
cmd.Parameters.AddWithValue("@price", price);
cmd.Parameters.AddWithValue("@scode", supplierCode);//corrected the "key codes"
myCon.Open();
cmd.ExecuteNonQuery();
myCon.Close();//added these lines of codes
}