Home > Software engineering >  Vs2010 do register login interface, in order to realize the function of the register, want to connec
Vs2010 do register login interface, in order to realize the function of the register, want to connec

Time:10-06

I want to be a can register account login interface, check a lot of information online, look up to is vc6.0 version, added a lot of mistakes, because there has been no contact, still can't solve the problem, I now login registered with MFC did out interface, function or not achieve them, under the great god give directions, or give me some resources can ah, he studied for two days, connect to the database there still don't understand,

CodePudding user response:

Access database using ado link

Baidu method!

CodePudding user response:

1. Do first login dialog, the main dialog to add the following code to initialize:
1.1 the resources needed to initialize the code dialog,
1.2 used to initialize the database environment, connect to the database,
2. Add the following code in the login dialog, such as user name and password stored in the database, by comparing the data in the data to confirm the login
I ever did was give a login box for your reference, the code is as follows:
 

The UpdateData (true);
Static int input_Qty=0;
Int perm_temp;
If (m_Username. IsEmpty () | | m_Password. IsEmpty ())
{
MessageBox (" note: the user name or password can't be empty ");
}
Input_Qty + +;//calculate number of login
Cstrings SQLstr SQLtemp;//database query
//create instances, you connect you record set
TheApp. M_pRecordset. CreateInstance (_uuidof (you));
//build SQL query string
SQLstr. The Format (" select * from tb_User_info where User_name='% s' and Password=' % s' ", m_Username, m_Password);
//query you record sets, and return you the record pointer
TheApp. M_pRecordset=theApp. M_pConnection - & gt; Execute (_bstr_t (SQLstr), NULL, adCmdText);
//whether you record set a pointer to the footer, is: indicates that the login information matching failure; No: indicates that the login information matching success;
if(! TheApp. M_pRecordset - & gt; AdoEOF)//
{
//save user name
M_user=m_Username;
The Username=m_Username;
//get the user login permissions
_variant_t var=(_variant_t) theApp. M_pRecordset - & gt; GetCollect (" Permissions ");
//change _variant_t to int
Var. ChangeType (VT_I4);
Perm_temp=var. LVal;//user permissions after converted to int, passed to the temporary variable
Perm=perm_temp;
CDialog: : OnOK ();//close the login box, enter the main dialog
}
The else
{
CProduct_ManageSystemDlg DLG.
If (3==input_Qty)
{
MessageBox (" entered an incorrect password three times!" );
CDialog: : OnCancel ();//lose the wrong password three times in a row, close the login window.
//DLG. OnCancel;
//DLG. CloseWindow ();
}
The else
{
MessageBox (" username or password is not correct!" );
M_Username="";
M_Password="";
The UpdateData (false);

}
}

CodePudding user response:

Add my qq, help you,

CodePudding user response:

The login screen approach:

http://blog.csdn.net/qinde025/article/details/7914986

Database you didn't say anything, I also can't help you a kid
  • Related