2015/07/23///////////////////
by xbw///////////////////////////
Environmental vs2013///////////////
Solve the problem, solve the landing can only use digital landing problems, there are automatic data recording problems;
This can only use digital landing is later debugging out of the bug, did not think, in order to debug convenience, only with the account number of 1, the password for the test, and now found the problem,, in fact, as long as the code to change the good,,,
/*dbset.getfieldvalue (_t ("Name"), Var); Sname = (LPCSTR) var.pbstrval;dbset. GetFieldValue (_t ("PSW"), Var); SPSW = (LPCSTR) var.pbstrval;dbset. GetFieldValue (_t ("score"), Var); Sscore = (LPCSTR) var.pbstrval;*/_variant_t varname, varpsw;varname = Dbset.getfieldvalue (_t ("Name")); VARPSW = Dbset.getfieldvalue (_t ("PSW")); Sname = (LPCSTR) _bstr_t (varname); SPSW = (LPCSTR) _bstr_t (VARPSW);
compare it;;; really did not think, modified a half-day and should go back, still do not understand Ah, can only disorderly groping;;;;
As for the automatic recording of the problem, this is also the use of global variables, it is easy to solve;;;
/*dbset.getfieldvalue (_t ("Name"), Var); Sname = (LPCSTR) var.pbstrval;dbset. GetFieldValue (_t ("PSW"), Var); SPSW = (LPCSTR) var.pbstrval;dbset. GetFieldValue (_t ("score"), Var); Sscore = (LPCSTR) var.pbstrval;*/_variant_t varname, varpsw;varname = Dbset.getfieldvalue (_t ("Name")); VARPSW = Dbset.getfieldvalue (_t ("PSW")); Sname = (LPCSTR) _bstr_t (varname); SPSW = (LPCSTR) _bstr_t (VARPSW), if (Sname.compare (m_logname) = = 0 && spsw.compare (m_logpsw) = = 0)//If the password and account are consistent with the database {user = M_logname; MessageBox (_t ("Login success!"), _t ("tenderness hint")); Cdialog::onok (); first = 0;break;} Else{dbset.movenext ();}
Compare with what is different from before,, more a sentence user=m_logname;;
This user is a global variable, and,
if (sname.compare (user) = = 0)//If the password and account are consistent with the database {Dbset.edit ();D bset. SetFieldValue (_t ("Score"), _variant_t (STR));D bset. Update (); MessageBox (_t ("Record stored"), _t ("tenderness hint")); first = 0;break;}
This is a good way to change the record, change to user;;;;
I am so happy that I can finally submit it.;;;;
Show off my accomplishments.
In this way, there is a need for engineering documents of the message yo, I will send you!!!!
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Windows Programming-Aircraft War notes (resolve input mixed password account, end automatically record data)