我这段vs 数据库 代码,提示有语法错误,多谢了。
提示 在“user”附近有语法错误。我的数据库用户名和密码都是varchar 50 的
public static bool checkUser(string username,string pwd) {
SqlConnection con = DBCon();
con .Open ();
string user = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(username.Trim(), "MD5");
string passWord = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(pwd.Trim(), "MD5");
SqlCommand com = new SqlCommand("select count(*) from user where username='"+user+ "'and password='"+passWord+"'",con);
int i = Convert.ToInt32(com.ExecuteScalar());
con.Close();
if(i>0) { return true; }
else{ return false; }