|
That is really a novel idea. But upto my knowledge (which is bit of a dumb kind ) all 64 bit OS handle 32 bit data safely. I mean there is a back compatibility available which would allow safe usage without any data loss. I think they do padding and all to convert the 32 bit data to 64 bit.
If you really want to see if LPCTSTR works fine with both 64 bit and as well 32 bit transparently then develop an Appl in 32 bit compiler and then try executing it in 64 bit. I am a bit vague about further details regarding 32 bit and 64 bit compatibility issues.
There are only two kinds of people who are really fascinating-people who know absolutely everything, and people who know absolutely nothing.
Oscar Wilde (1854-1900)
Regards...
Shouvik
|
|
|
|
|
It is ok. Thanks for your support for all the help you given to me on the question all the way.
regards,
George
|
|
|
|
|
George_George wrote: Thanks for your support for all the help you given to me on the question all the way.
That is the spirit @ CP and that is what makes my day happier while spending my day here. We all come back for a reason.
Actually one more thing to say is that LPCTSTR is strictly a Win32 stuff so please investigate it's memory implications then only proceed.In case you get to know some APIs which are translating 32 to 64 bit please share with us too.
There are only two kinds of people who are really fascinating-people who know absolutely everything, and people who know absolutely nothing.
Oscar Wilde (1854-1900)
Regards...
Shouvik
|
|
|
|
|
|
Thanks, good link!
regards,
George
|
|
|
|
|
|
It means you have a bug in your code, why not try the debugger ?
|
|
|
|
|
thanks for reply sir
i use debugger and debugger shows this error in msgbox
and my code is as sir :
int i;
MYSQL *myDB;
MYSQL_RES *res;
MYSQL_ROW row;
CString user,pass,aqp;
if ((myDB = mysql_init((MYSQL*) 0)) &&
mysql_real_connect(myDB,"localhost","root",NULL,NULL,3306,NULL,NULL))
{
if ( mysql_select_db( myDB,"gourav") < 0 )
{
MessageBox("Can't select the database !\nTry later.");
goto exit_here;
}
else
{
MessageBox("Can't connect !\nPlease try later.") ;
goto exit_here;
}
}
GetDlgItemText(IDC_USER,user);
GetDlgItemText(IDC_PASS,pass);
if(mysql_query(myDB,"select * from login"))
res=mysql_store_result(myDB);
row = mysql_fetch_row(res);
MessageBox(row[0]);
exit_here:
mysql_close( myDB);
please sir help me to solve this one
thanks again
hi
|
|
|
|
|
No problem, does the debugger indicate which line might be cusing the access violation ?
Try changing the code a little as your error handling could be improved, I rewrote it like this, but obviously have not tested it, so give it a go and see if that improves anything.
int i;
MYSQL *myDB = NULL;
MYSQL_RES *res = NULL;
MYSQL_ROW row;
CString user,pass,aqp;
if((myDB = mysql_init((MYSQL*) 0)) &&
mysql_real_connect(myDB,"localhost","root",NULL,NULL,3306,NULL,NULL))
{
if(mysql_select_db( myDB,"gourav"))
{
GetDlgItemText(IDC_USER,user);
GetDlgItemText(IDC_PASS,pass);
if(mysql_query(myDB,"select * from login"))
{
res=mysql_store_result(myDB);
row = mysql_fetch_row(res);
MessageBox(row[0]);
}
}
else
MessageBox("Can't connect !\nPlease try later.") ;
mysql_close(myDB);
}
regards,
|
|
|
|
|
thanks sir
sir i try this one but it does not work
as same error at line
row = mysql_fetch_row(res);
before this same error at same line
thanks
hi
|
|
|
|
|
What is the value of 'res' when this line is executed, you'll need to strp through the code in your debugger.
res=mysql_store_result(myDB);
|
|
|
|
|
sir after debugging :
myDB shows this value 0x00ba4008
and res shows this 0x00000000
thanks.
hi
|
|
|
|
|
I suspect the call is failing, have you tried adding mysql_error() to see if you get an error.
Also, change this part of the code:
if(mysql_query(myDB,"select * from login"))
{
res=mysql_store_result(myDB);
row = mysql_fetch_row(res);
MessageBox(row[0]);
}
to this:
<pre
if(mysql_query(mydb,"select *="" from="" login"))
{
="" res="mysql_store_result(myDB);
" if(res)
="" {
="" row="mysql_fetch_row(res);
" if(row="" !="FALSE)
" messagebox(row[0]);
="" }
}<="" pre="">
|
|
|
|
|
yes sir i think u r right call is failing
becauze when debugger comes on if(res) it will show login window again
and this will stop debugger
but i dont know sir why this if(mysql_query(myDB,"select * from login"))
is not fetching result
[sir i use mysql 6.0 and VC++ 6.0(is there any problem Sir)]
hi
|
|
|
|
|
Are there any records in the database table ?
|
|
|
|
|
yes sir
i have database gourav , a table login and
this table has three fields user , password and id
and there are three records in this table
hi
|
|
|
|
|
What is the return value from the mysql_query(myDB,"select * from login")) function ?
Change it to this for a test:
int i = mysql_query(myDB,"select * from login");
What is the value of i ?
|
|
|
|
|
sir return value for
int i = mysql_query(myDB,"select * from login");
and i shows value 1 when use debugger
hi
|
|
|
|
|
Add the try/catch block that Shouvik suggested, it should help diagnose the problem.
|
|
|
|
|
thanks a lot sir
u have devoted a lot of time for me
thanks a lot
hi
|
|
|
|
|
No problem, just trying to help a fellow coder.
|
|
|
|
|
Surround the code for retrieving with a try and catch. then get the error reason by catching the Exception object throught the method what();
I think Jonathan is right. The recordset value is NULL and hence throws an Acess Violation Error
There are only two kinds of people who are really fascinating-people who know absolutely everything, and people who know absolutely nothing.
Oscar Wilde (1854-1900)
Regards...
Shouvik
|
|
|
|
|
sir thnaks
but i dont know about the what(); function
so can u help me sir
thanks
hi
|
|
|
|
|
Actually I'm not well versed with ODBC section in VC 6.0 So I m just givin u a generalized concept.
Whenever you surround any code with try catch you throw an exception which is the Object of CException Class.
try
{
}
catch(CException e)
{
MessageBox(e.what());
}
So this way you can atleast trace what error are u getting.
There are only two kinds of people who are really fascinating-people who know absolutely everything, and people who know absolutely nothing.
Oscar Wilde (1854-1900)
Regards...
Shouvik
|
|
|
|
|
sir what() is not working with this
it will give error
'what' : is not a member of 'CException'
please sir solve this
thanks
hi
|
|
|
|