I use the library "Dapper" to connect with MS Sql.
When I call stored procedure, it show error message
can not find stored procedure.
But stored procedure it already exist in Database. How can I resolve this problem? thanks.
public static string WrtoLogDb(string id, string id1)
{
using (var conn = new SqlConnection(connStrTest))
{
try
{
conn.Open();
var strf33_schD = conn.ExecuteScalar<int>("exec DelClsCourTimeTest", new { id, id1 }, commandType: CommandType.StoredProcedure);
return strf33_schD.tostring();
}
catch (Exception EX)
{
return EX.ToString();
}
}
}
When the CommandType
is set to StoredProcedure
then the CommandText
should just be the procedure name, in your case "DelClsCourTimeTest"
.