永发信息网

SqlCommand出现错误!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

答案:1  悬赏:0  手机版
解决时间 2021-02-13 20:48
  • 提问者网友:龅牙恐龙妹
  • 2021-02-13 01:22
SqlCommand cmd=new SqlCommand("select count(*) from login where userName='"+userName+"' and userPwd='"+userPwd"'",con);
//"'",con)这行打了红色波浪线总是说应输入;
到底哪里出了问题?

大家快点快点快点~~~~~~~~~~~~~~~~~~~~~
最佳答案
  • 五星知识达人网友:轻雾山林
  • 2021-02-13 02:11
SqlCommand cmd=new SqlCommand("select count(*) from login where userName='"+userName+"' and userPwd='"+userPwd这里缺个加号"'",con);
应该这样写 就不会乱了 先 string str=string.Format("select count(*) from login where userName='{0}' and userPwd='{1}'",userName,userPwd);
然后SqlCommand cmd=new SqlCommand(str,con);
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯