有关C#下的登陆验证,小问题,可惜偶比较菜 就是先验证数据库里面首先有没有这个用户然后就是验证密码是否正确如果都正确,允许进入跳转。最好能够有点源代码,谢谢!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 高手请指教,我已经通过SqlConnection 连接到数据库了 使用sqlcommand,sqldataadapter,dataset这几个类,相关方法:sqlcommand.commandtext,connectionsqldataadapter.selectcommand,filldataset.tables(0).rows(0).item(0)取得密码,验证一下即可 楼上的可以说详细点么?我现在就是不会,该如何把select得到的那些元组绑定到变量上去。 string strSql="select * from user where user=username and password=password";sqlCommand=new sqlcommand(strSql,strConnect);sqlRead=sqlCommand.ExecuteRead();if(sqlRead.Read()){//成功}else{//失败}sqlRead.Close(); 大哥,帮小弟看看哪里有问题。谢谢!!!SqlConnection myConnection = new SqlConnection(myConnectionString); SqlCommand myCommand = new SqlCommand("select * from admin where ID="+this.textBox1.Text+"and PsWd = "+this.textBox2.Text); myCommand.Connection = myConnection; myConnection.Open(); myCommand.ExecuteNonQuery(); SqlDataReader myReader; myReader = myCommand.ExecuteReader(); if(myReader.Read()) MessageBox.Show("OK"); else MessageBox.Show("error"); myCommand.Connection.Close(); pdf怎么存入mysql数据库 如何提高转换精度start.X = float.Parse(code.Value); 如何开发可以输入文本的进度条c# c# 采集网页所有网址怎么补全不完整地址? ComboBox的SelectedIndexChanged事件 反射调用dll的问题 RichTextBox插入图片问题 崩溃……!水晶报表服务器部署登录失败,试尽所有方法就不见效! winGorm程序如何修改光标 c#中可以调用DCOM吗?如果可以,怎么调用啊? 高手指点:我现在要做三维分子程序,不知道用c#做的话需要哪些技术? 捕获关机事件和Form_Closing冲突问题
sqlcommand.commandtext,connection
sqldataadapter.selectcommand,fill
dataset.tables(0).rows(0).item(0)取得密码,验证一下即可
sqlCommand=new sqlcommand(strSql,strConnect);
sqlRead=sqlCommand.ExecuteRead();
if(sqlRead.Read())
{
//成功
}
else
{
//失败
}
sqlRead.Close();
SqlCommand myCommand = new SqlCommand("select * from admin where ID="+this.textBox1.Text+"and PsWd = "+this.textBox2.Text);
myCommand.Connection = myConnection;
myConnection.Open();
myCommand.ExecuteNonQuery();
SqlDataReader myReader;
myReader = myCommand.ExecuteReader();
if(myReader.Read())
MessageBox.Show("OK");
else MessageBox.Show("error");
myCommand.Connection.Close();