Home > Net >  C # Windows interface
C # Windows interface

Time:11-19



Has bosses know this how to get there, the user name and password, the authentication code, to verify login together at the same time, I got this, user name and also can enter when the verification code wrong
Verification code by the way, when several users and also can help the novice,

CodePudding user response:

It is best to post code! Provides a train of thought: 1, judge the value of the three text boxes are meet your validation, in the if use & amp; Meet to do the validation, if all conform to login successfully! 2: one by one, if one does not meet directly with return to return, return after won't execute that code

CodePudding user response:

Private void textUser_TextChanged (object sender, EventArgs e)
{

}

Private void button1_Click (object sender, EventArgs e)
{
String Loginid=this. TextUser. Text;
String Loginpwd=this. TextPwd. Text;
String SQL=the string. Format (" select * from Admins where LoginId='{0}' and LoginPwd='{1} ", LoginId, LoginPwd);
SqlDataReader rd=DBHelper. GetDataReader (SQL);

If (rd., Read ())
{
MessageBox. Show (" landing successful ", "warning:", MessageBoxButtons. YesNo, MessageBoxIcon. Question);



}
The else
{
MessageBox. Show (" login failed, please login again ");

}
Rd. The Close ();




if (! Enclosing txtValidCode. Text. Equals (validCode CheckCode))
{

MessageBox. Show (" please input the correct verification code!" , this Text);

This. TxtValidCode. Focus ();
Enclosing txtValidCode. Text="";

return;

}
The else
{
MessageBox. Show (" success!" );





}

This is the wrong code, just don't know how can they verify together

CodePudding user response:

Get the user and password for the Trim () to remove the blank space select * from together by space should be ok
  • Related