public bool ValidateUser(string userType, string userId, string pwd, ref string message)
{
int count = 0;//数据库查询的结果
bool isValidateUser = false;//返回值,是否找到该用户
//查询数据库中是否存在与登录时输入的用户名密码用户类型匹配的信息
string sql = "select count(*) from user where userId='"+userId+"' and userType='"+userType+"' and pwd='"+pwd+"'";
//string sql = string.Format("select COUNT(*) from dbo.user where userId=admin AND userType=管理员 AND pwd=123456");
try
{
conn.connection.Open();
SqlCommand command = new SqlCommand(sql, conn.connection);
count=(int)command.ExecuteScalar();
if (count == 1)
{
isValidateUser = true;
}
报错‘user’附近有语法错误,我看了很多遍也没看出错误在哪,麻烦大虾们帮帮忙