Windows Programming-Aircraft War notes (resolve input mixed password account, end automatically record data)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.