|
download from codeproject website
|
|
|
|
|
Vu Ngoc Quyen wrote: I embed excel to my program...
How did you do this?
Vu Ngoc Quyen wrote: How can I open excel file?
Using what method?
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Vu Ngoc Quyen wrote:
Hi expert
I embed excel to my program and now I can't not open file excel.
Which Interface are you using?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Hello all's
i am new in VC++ and feel some problem in my program
i am trying to making a login program but in some line
i think i am wrong .The code of that line are below
can any one help me and also tell me where i am wrong
int i, j, k;
MYSQL * myDB ;
MYSQL_RES * res,*res1;
MYSQL_ROW row,row1;
CString sStr, sPwd;
SetDlgItemText(IDC_STATIC, "Logging in. Please wait...");
if ( (myDB = mysql_init((MYSQL*) 0)) &&
mysql_real_connect( myDB, "localhost", " ", NULL, NULL, MYSQL_PORT, NULL, CLIENT_MULTI_STATEMENTS ) )
{
if ( mysql_select_db( myDB, "login") < 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;
}
sStr.Empty();
GetDlgItemText(IDC_USER, sStr);
sStr = "CALL sp_auth_user(\'" + sStr + "\', \'";
GetDlgItemText(IDC_PASS, sPwd);
sStr = sStr + sPwd + "\');";
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;
}
SetDlgItemText(IDC_STATIC, "Login Successful.");
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]) ;
sStr = "Welcome - ";
sStr += (((row[2]==NULL)||(!strlen(row[2])))?"NULL":row[2]) ; // Name
sStr += " (";
sStr += (((row[1]==NULL)||(!strlen(row[1])))?"NULL":row[1]) ; // Group
sStr += ")";
SetDlgItemText(IDC_STATIC, sStr);
}
mysql_free_result( res ) ;
}
else
SetDlgItemText(IDC_STATIC, "Could not execute query on server.") ;
Please mailing me
|
|
|
|
|
But what is your problem.
Is the application crashing at some point. or are you not able to verify the user login and password.....
From a look at your code what I feel is there is something wrong in the conditions . given here with the goto exit_here statements ie if the we are not connected to the database you are checking the password.
if ( mysql_select_db( myDB, "login") < 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;
}
in ti
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
-- modified at 5:29 Friday 9th June, 2006
|
|
|
|
|
My problem is that application is looked after creating database connection
and it not check the below if condition:
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;
}
SetDlgItemText(IDC_STATIC, "Login Successful.");
application are blocked before
plz tell me that the line of code
sStr.Empty();
GetDlgItemText(IDC_USER, sStr);
sStr = "CALL sp_auth_user(\'" + sStr + "\', \'";
GetDlgItemText(IDC_PASS, sPwd);
sStr = sStr + sPwd + "\');";
is correct or not.
Thanking you
Please mailing me
|
|
|
|
|
Hi there.
I have an application that uses CRecordset to query the contents of a large MSSQL database table. The main task of this application is to loop through the CRecordset using CRecordset::MoveNext() and print each record to a file on disk.
Unfortunately, calling MoveNext() with DoFieldExchange causes the SQL database to be queried singly for each and every row - causing performance issues on the SQL Server (there are many thousand records).
To improve the performace, I'm looking at using DoBulkFieldExchange so that more than one record at a time are queried. However, I'm having trouble finding info for this approach on the web.
Q: Is this a wise approach to take (the lack of web resources is making me nervous!)?
If so, any ideas of where I could find good code samples?
If not, what other approaches could be taken?
Any halp would be much appreciated!
Len
|
|
|
|
|
Hi
I am trying to develop an activex control. The control has methods to respond to the WM_KEYDOWN messages and in the test container these seem to be working but when a put the control on a dialog window the control doesn't seem to get the focus - seems to remain with the dialog window as the OK and cancel buttons flash wildly when I press the up and down keys. How can I get the messages through to the control.
Thanks
Andrew Hoole
|
|
|
|
|
What framework (if any) are you using? ATL, MFC?
Steve
|
|
|
|
|
Sorry. I am using Visual C++ 6 and MFC.
Andrew
|
|
|
|
|
Does the control receive the focus and then WM_KEYDOWN messages if you first click it with the mouse?
|
|
|
|
|
No the control is handle mouse message just fine but even after clicking in the window several times the key messages don't get through.
See my further post regarding how I might have fixed it. My concern now is if I have several of these controls on a dialog which one will respond to the messages.
Andrew
|
|
|
|
|
Hi
I have solved my problem by making my control handle the WM_GETDLGCODE and forcing it to return DLGC_WANTARROWS|DLGC_WANTALLKEYS|DLGC_WANTCHARS;
Still to discover if this has further consequences.
Andrew Hoole
|
|
|
|
|
i want to fetch date from mysql table into mfc dialog box date time picker control
wat problem is that date stored in mysql in format yyyy-mm-dd
and mfc store in the format dd-mm-yyyy
so it does not fetch the date only
can u tel me the code how to fetch date from mysql format yyyy-mm-dd
into mfc format dd-mm-yyyy
Please mailing me
|
|
|
|
|
Why don't you simply extract the date out of the table, convert it to the format of the date-time control (so, invert it) and put it in the control ?
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
i have the problem that i dont want on;y date other fields r there
which r fetched without any problem
but only date hav problem
but how i convert yyyy-mm-dd format into date time control
can u tel me
Please mail me
|
|
|
|
|
fetch the date from the table . You will be having the date somewhere in the string. Now extract that date by tokenizing or whatever method you choose and than format the date using
CString::Format();
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
you could use str_to date(date format) for solving your problem
yogi
Please mailing me
|
|
|
|
|
yogendra kaushik wrote: i want to fetch date from mysql table into mfc dialog box date time picker control
wat problem is that date stored in mysql in format yyyy-mm-dd
and mfc store in the format dd-mm-yyyy
so it does not fetch the date only
can u tel me the code how to fetch date from mysql format yyyy-mm-dd
into mfc format dd-mm-yyyy
Here is the code ... which converts the date extracted from the mysql and put it into DTPicker control.
CString strTestDate("2006-05-05");
SYSTEMTIME currTime;
GetSystemTime(&currTime);
sscanf(strTestDate.GetBuffer(0),"%u-%u-%u",&currTime.wYear,&currTime.wMonth,&currTime.wDay);
strTestDate.ReleaseBuffer();
m_DateTime=CTime(currTime);;
UpdateData(0); Where strTestDate is fetched date from mysql. and m_DateTime is the control variable of the DTPicker control of type CTime.
here GetSystemTime is required to get the correct format result of the date picked from the mysql table.
Hope you are looking for same.
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
the problem:
=============
i use a flash object in VC6 dialoge MFC (on winxpsp2), try to subclass this object by all methods never, try to use SetWindowLong with him dosn't work, try to catch any messages from him callback don't work , any thing don't know why
what i want :
=============
is to prevent the right popup menu of macromedia Inc and replace it with
a menu from our dialoge ,i reinsatall windows 3 times and vc6 3 times and replace 3 pc's with win98 win2000 and nothing happen the same result .
Could you :
=============
send me an Example of how to subclass or even recive the WM_RBUTTONDOWN
from the flash object (ocx)
feel free to contact
haitham_hamed@yahoo.com
|
|
|
|
|
|
CString s;
LPCTSTR st;
s += CString(st);
in fact, I thought s += st would work.
Christian Graus - Microsoft MVP - C++
-- modified at 4:25 Friday 9th June, 2006
|
|
|
|
|
NoName II wrote: How can I append LPTSTR to CStirng
Here is another way how we can append the LPTSTR to CString
CString strTest("Hello");
LPTSTR lpStr=" World";
strTest.Insert(strTest.GetLength(),lpStr); We can directly add the strings using += operator as it overloaded in CString class
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
See
<br />
LPTSTR lpt;<br />
lpt=(LPTSTR)LocalAlloc(LPTR,256);<br />
strcat(lpt,"test");<br />
CString str;<br />
str=str+lpt;<br />
str.Insert(0,lpt);<br />
str.Append(lpt);<br />
LocalFree(lpt);<br />
whitesky
|
|
|
|
|
have you ever tried the simplest way (with + or += operators) ?
CString str = "hello ";
str += "world !!";
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
|
|
|
|