关于C#连接My sql中cmd.ExecuteReader提示错误
privateboolIsLogin(stringname,stringpwd){using(MySqlConnectionconn=newMySqlConnection...
private bool IsLogin(string name ,string pwd)
{
using (MySqlConnection conn = new MySqlConnection(conStr))
{
string sql = "select * from [users] where uLoginId =@name and uPwd =@pwd";
using (MySqlCommand cmd =new MySqlCommand(sql, conn))
{
conn.Open();
using (MySqlDataAdapter reader = cmd.ExecuteReader())
{
if (reader.HasRows)
{
return true;
}
else
{
return false;
}
}
}
}
}
其中cmd.ExecuteReader和 reader.HasRows提示错误,该怎么写呢 谢谢! 展开
{
using (MySqlConnection conn = new MySqlConnection(conStr))
{
string sql = "select * from [users] where uLoginId =@name and uPwd =@pwd";
using (MySqlCommand cmd =new MySqlCommand(sql, conn))
{
conn.Open();
using (MySqlDataAdapter reader = cmd.ExecuteReader())
{
if (reader.HasRows)
{
return true;
}
else
{
return false;
}
}
}
}
}
其中cmd.ExecuteReader和 reader.HasRows提示错误,该怎么写呢 谢谢! 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询