Quote:
i got this error "System.Data.SqlClient.SqlException: 'Procedure or function 'SelectData' expects parameter '@productName', which was not supplied."
Did you try to do exactly what the message says, aka provide parameters?
SqlCommand cmd = new SqlCommand();
cmd.CommandText = "SelectData";
cmd.CommandType = System.Data.CommandType.StoredProcedure;
cmd.Connection = con;
cmd.Parameters.AddWithValue("@productName", Product.Text);
cmd.Parameters.AddWithValue("@unitPrice", UnitPrice.Text);
con.Open();
[Update]
Quote:
is that a parameter for select statment or for the insert statment in sql
As per your question, the
SelectData stored procedure is a
select procedure.
But parameters to an insert procedure are working the same.