问题描述
stringpws=this.textBox1.Text.Trim();stringmyConStr="Provider=Microsoft.Jet.OLEDB.4.0;DataSource=LXL.mdb;";OleDbConnectionmyCon=newOleDbConnection(myConStr);myCon.Open();stringmm="Select密码Frommimawhere密码='"+pws+"'";这是开始的语句,请各位帮我写一下后面的,我弄不出来啊.谢谢了!我现在就是不知道返回对比结果的语句,请各位帮我写哈啊!C#语句!
解决方案
解决方案二:
stringpws=this.textBox1.Text.Trim();stringusername="";//获取用户名stringmyConStr="Provider=Microsoft.Jet.OLEDB.4.0;DataSource=LXL.mdb;";OleDbConnectionmyCon=newOleDbConnection(myConStr);myCon.Open();stringmm="Select密码Frommimawhereusername='"+username+"'";if(mm==pwd){//登录}else{//用户名和密码错误}
解决方案三:
OleDbCommandcommand=newOleDbCommand(mm,myCon);objectobj=command.ExecuteScalar();if(obj==Db.DBNull.Value){//密码错误}
解决方案四:
不小心多写了个Db.OleDbCommandcommand=newOleDbCommand(mm,myCon);objectobj=command.ExecuteScalar();if(obj==DBNull.Value){//密码错误}
解决方案五:
OleDbCommandcommand=newOleDbCommand(mm,myCon);OleDbDataReaderreader=command.ExecuteDataReader();stringsPwd=String.Emptytry{if(reader!=null&&reader.read(){sPwd=reader.GetString(0);}if(sPwd.Trim==pws){//loginmyCon.Close();}else{//errorhandling.}}catch(){myCon.Close();}canuseDatasetandsoon.