I am trying to insert data into a SQL Server database by calling a stored procedure, but I am getting the error
*Procedure or function \'Insertion\'
This is how it can be done
using (var cmd = new SqlCommand("STORED_PROCEDURE_NAME", SqlConnection)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@PARAM_NAME", PARAM_VALUE); }
Notice that AddWithValue, and CommandType.StoredProcedure both are essential.
AddWithValue
CommandType.StoredProcedure