我是Dapper的新手。
当我在SSMS中执行SQL语句时,一切正常。所以我按照这一步骤如何使用来自here
的Dapper执行存储过程这是我的代码段:
using (IDbConnection conn = new SqlConnection(ConfigurationManager.AppSettings["SQLSERVER_CONNECTION_STRING"]))
{
conn.Open();
var getAccount = conn.Query<ReportAccountCreation.AccountFields>("GetAccountCreationByDate",
new { dateFrom = DateTime.Today.AddYears(-3), dateTo = DateTime.Today, ItemID = 111, department = (string)null },
commandType: CommandType.StoredProcedure);
conn.Close();
if(getAccount.Count() > 0)
{
RC.lAccount = getAccount.ToList();
}
但没有返回任何价值。我的代码出了什么问题?