ExecuteScalar 找不到存储过程
ExecuteScalar can not find stored procedure
我使用库 "Dapper" 连接 MS Sql。
当我调用存储过程时,它显示错误消息
can not find stored procedure.
但是存储过程它已经存在于数据库中。
我该如何解决这个问题?谢谢。
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();
}
}
}
当 CommandType
设置为 StoredProcedure
时,CommandText
应该只是过程名称,在您的情况下 "DelClsCourTimeTest"
.
我使用库 "Dapper" 连接 MS Sql。
当我调用存储过程时,它显示错误消息
can not find stored procedure.
但是存储过程它已经存在于数据库中。 我该如何解决这个问题?谢谢。
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();
}
}
}
当 CommandType
设置为 StoredProcedure
时,CommandText
应该只是过程名称,在您的情况下 "DelClsCourTimeTest"
.