Click here to Skip to main content
15,902,112 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Creating XP themes [modified] Pin
Hamid_RT7-Jun-06 20:55
Hamid_RT7-Jun-06 20:55 
QuestionAbout Edit box Pin
Saday Sarkar7-Jun-06 19:53
Saday Sarkar7-Jun-06 19:53 
AnswerRe: About Edit box Pin
Hamid_RT7-Jun-06 19:59
Hamid_RT7-Jun-06 19:59 
AnswerRe: About Edit box Pin
Amar Sutar7-Jun-06 20:02
Amar Sutar7-Jun-06 20:02 
AnswerRe: About Edit box Pin
Hamid_RT7-Jun-06 20:12
Hamid_RT7-Jun-06 20:12 
GeneralRe: About Edit box [modified] Pin
Saday Sarkar7-Jun-06 21:03
Saday Sarkar7-Jun-06 21:03 
Questionany ideas to improve search performance in a tree structure [modified] Pin
George_George7-Jun-06 19:52
George_George7-Jun-06 19:52 
Questionabout listbox Pin
happy_ram7-Jun-06 19:45
happy_ram7-Jun-06 19:45 
AnswerRe: about listbox Pin
Naveen7-Jun-06 20:22
Naveen7-Jun-06 20:22 
QuestionRe: about listbox Pin
happy_ram7-Jun-06 20:31
happy_ram7-Jun-06 20:31 
AnswerRe: about listbox Pin
Naveen7-Jun-06 20:34
Naveen7-Jun-06 20:34 
GeneralRe: about listbox [modified] Pin
happy_ram7-Jun-06 20:38
happy_ram7-Jun-06 20:38 
GeneralRe: about listbox [modified] Pin
Naveen7-Jun-06 21:02
Naveen7-Jun-06 21:02 
QuestionRe: about listbox [modified] Pin
happy_ram7-Jun-06 21:13
happy_ram7-Jun-06 21:13 
AnswerRe: about listbox [modified] Pin
Naveen7-Jun-06 22:09
Naveen7-Jun-06 22:09 
GeneralRe: about listbox Pin
vasusree7-Jun-06 22:53
vasusree7-Jun-06 22:53 
QuestionWord File Pin
Sharath867-Jun-06 19:39
Sharath867-Jun-06 19:39 
AnswerRe: Word File Pin
NiceNaidu7-Jun-06 19:48
NiceNaidu7-Jun-06 19:48 
GeneralRe: Word File Pin
Steve Echols7-Jun-06 19:51
Steve Echols7-Jun-06 19:51 
GeneralRe: Word File Pin
Sharath867-Jun-06 20:11
Sharath867-Jun-06 20:11 
AnswerRe: Word File Pin
Hamid_RT7-Jun-06 20:02
Hamid_RT7-Jun-06 20:02 
QuestionLogin paswrd problem [modified] Pin
p_7-Jun-06 19:26
p_7-Jun-06 19:26 
when i enter usename and password it will give that incorrect usename and password plz try later option
even that username and password are in the mysql table users
plz tel me or send me any working code


i make a dialob box in mfc which contain two edit controls one for usename and other for password and a button for login
now i made a table users in mysql which contain user names and passwords
now i want when i click on login button the usename and passwrd conformation is made from mysql table and it then login else not
i use this code but ot not works for me plz tel me the code:::

void CPasswordDlg::OnLog()
{
int i, j, k;
MYSQL * myDB ;
MYSQL_RES * res,*res1;
MYSQL_ROW row,row1;
CString sStr, sPwd;

GetDlgItem(IDC_LOG)->EnableWindow(FALSE);
SetDlgItemText(IDC_STATIC, "Logging in. Please wait...");

if ( (myDB = mysql_init((MYSQL*) 0)) &&
mysql_real_connect( myDB, "localhost", "root", NULL, NULL, MYSQL_PORT, NULL, CLIENT_MULTI_STATEMENTS ) )

{
if ( mysql_select_db( myDB, "gourav") < 0 )
{
SetDlgItemText(IDC_STATIC, "Can't select the database !\nTry later.") ;
goto exit_here;
}
}
else
{
SetDlgItemText(IDC_STATIC, "Can't connect to the mysql server !\nPlease try later.") ;
goto exit_here;
}




GetDlgItemText(IDC_USER, sStr);
GetDlgItemText(IDC_PASS, sPwd);

sStr = "SELECT * FROM Users WHERE UserID=\'" + sStr + "\'";
if ( ! mysql_query( myDB, sStr) )
{
res = mysql_store_result( myDB ) ;
i = (int) mysql_num_rows( res );
if (i != 1)
{
SetDlgItemText(IDC_STATIC, "Incorrect User Name / Password. Please try again.");
mysql_free_result( res ) ;
goto exit_here;
}
if ( (row = mysql_fetch_row( res )) )
{
sStr.Empty();
j = mysql_num_fields( res ) ;
//for ( k = 0 ; k < j ; k++ )
// sStr += (((row[k]==NULL)||(!strlen(row[k])))?"NULL":row[k]) ;

sPwd = (((row[3]==NULL)||(!strlen(row[3])))?"NULL":row[3]);
GetDlgItemText(IDC_PASS, sStr);
sStr = "SELECT PASSWORD(\'" + sStr + "\')";
if ( ! mysql_query( myDB, sStr) )
{
res1 = mysql_store_result( myDB ) ;
if ( (row1 = mysql_fetch_row( res1 )) )
{
sStr = (((row1[0]==NULL)||(!strlen(row1[0])))?"NULL":row1[0]);
if (sStr == sPwd)
{
SetDlgItemText(IDC_STATIC, "Login Successful.");
}
else
SetDlgItemText(IDC_STATIC, "Incorrect User Name / Password. Please try again.");
}
mysql_free_result( res1 ) ;
}
else
SetDlgItemText(IDC_STATIC, "Could not execute query01 on server.") ;
}
mysql_free_result( res ) ;
}
else
SetDlgItemText(IDC_STATIC, "Could not execute query on server.") ;


exit_here:
GetDlgItem(IDC_LOG)->EnableWindow(TRUE);
mysql_close( myDB );

}





hi

-- modified at 2:13 Thursday 8th June, 2006
QuestionRe: Login paswrd problem Pin
Hamid_RT7-Jun-06 19:35
Hamid_RT7-Jun-06 19:35 
AnswerRe: Login paswrd problem Pin
p_7-Jun-06 20:33
p_7-Jun-06 20:33 
GeneralRe: Login paswrd problem Pin
kakan7-Jun-06 20:45
professionalkakan7-Jun-06 20:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.