Home > Software engineering >  Who can help to explain the meaning of this code, thanks a lot
Who can help to explain the meaning of this code, thanks a lot

Time:10-15

 void CLoginDlg: : OnOK () 
{
BOOL bLogin=FALSE;
Cstrings strPasswd strAuthority;

The UpdateData ();//update the data variable
if(! The Open (m_strDSN)) return;//connect to the database
CRecordset rs (& amp; Db);
Rs. The Open (CRecordset: : forwardOnly,
"Select the PASSWD, AUTHORITY from the PERSON where ID='" + m_strUser +"' ");
if(! Rs. IsEOF ())
{
Rs. GetFieldValue (" PASSWD ", strPasswd);
Rs. GetFieldValue (" AUTHORITY ", strAuthority);
If (strPasswd==CCrypt: : Encrypt (m_strPasswd, 123) & amp; &
StrAuthority=="3")
{
BLogin=TRUE;//connected
}
The else
MessageBox (" please enter the password again, \ n note case!" That "password error");
}
The else
{
MessageBox (" please make sure the username case whether it is right!" "Without the user");
}
Rs. The Close ();
If (bLogin) EndDialog (IDOK);
The else db. The Close ();//close the database
}

CodePudding user response:

Code function at the end of the day is not others to help you see or interpretation or comment; But by myself calm down and take a long enough time and energy to do it yourself step or set a breakpoint or step to perform to a certain intermediate result shows or written to the log file analysis step by step,
Remind: cow x teacher cannot replace the student understand and use the toilet!
Single step debugging and set breakpoint debugging (VS IDE compilation connection through later, press F10 or F11 key step, press Shift + F11 exit the current function; In a press F9 set breakpoints after press F5 execution stops at the breakpoint,) is one of the programmers must master the skills,

CodePudding user response:

Click OK when querying the database to validate a user's password, and according to the right or wrong to give tips,

CodePudding user response:

Does it not have comments?

CodePudding user response:

refer to the second floor piaobotudou response:
click OK when querying the database, verify the user password, and according to the right or wrong to give tips,


correct
  • Related