我使用小巧玲珑选择数据形式Mssql中选择数据,它导致显示“空”使用小巧玲珑从MS SQL
(使用存储过程,列表以获取数据,以及“myDictionary [0] .Account”和myDictionary [0] .Password获取详细信息),
但MS SQL数据库有数据。
我该如何修复代码?谢谢。
public void Do_Click(object sender, EventArgs e)
{
string strAccount = Request.Form["userAccount"];
string strPassword = Request.Form["userPwd"];
using (var conn = new SqlConnection(strConn))
{
try
{
conn.Open();
List<LoginModel> myDictionary =
conn.Query<LoginModel>(@"uspSelectLoginChk",
new { LoginAcc = strAccount, LoginPsd = strPassword }, commandType: CommandType.StoredProcedure).ToList();
string strAccountChk = myDictionary[0].Account;
string strPASChk = myDictionary[0].Password;
conn.Close();
if (strAccountChk != null && strAccountChk != null)
{
Response.Redirect("test.aspx");
}
else
{
}
}
catch (Exception ex)
{
response.write(ex.ToString());
}
}
}