[Message Deleted]
-
Quite blunt, but why do you say
if (!res)
? shouldn't it beif(res)
? (It depends on how you assume.But generally if a function executes successfully , it returns a positive value or atrue
, If the function is done by you, you follow it too)yogendra kaushik wrote:
if (i != 1)
And here, I suggest you check
(i>0)
(in general) and you miss theelse
part. make anelse
part of the secondif
then displayAfxMessageBox "Not Found!"
--[:jig:]-- [My Current Status]
yar this will not work as if it delete sucessfully it will not display message and if i enter wrong id it willnot display message Please mail me
-
[Message Deleted]
Maybe
mysql_num_rows
can be used only with SQL statements which return result set? Check the documentation. If no other solutions, I think you can first execute a SELECT statement in order to see if there is a row, then usemysql_num_rows
to check the result, and after this use DELETE. -
Maybe
mysql_num_rows
can be used only with SQL statements which return result set? Check the documentation. If no other solutions, I think you can first execute a SELECT statement in order to see if there is a row, then usemysql_num_rows
to check the result, and after this use DELETE.[Message Deleted]
-
[Message Deleted]
-
[Message Deleted]
First try hard-coding your SQL statement. i.e
select * from empinfo where empid = 111
and see if it works. Mostly the bug sits in the way we assemble the string. And if the hard-coding works fine, try to make your sql string and before excuting it, Display it in a message box or in a CEdit so that you could verify that you are passing a well formed query string. Or you can also set check points to see the string.
--[:jig:]-- [My Current Status]
-
sir u r the man who can solve any problem its amazing thanks a lot sir i want to fetch date from mysql table with other values that is when i press fetch button in mfc dialogbox it will display values from mysql table into dialog box's edit boxes . all values are fetched but date does not as the mysql date format is yyyy-mm-dd and the datetime picker in mfc has the format dd-mm-yyyy plz tel me how to fetch it Please mail me
-
sir u r the man who can solve any problem its amazing thanks a lot sir i want to fetch date from mysql table with other values that is when i press fetch button in mfc dialogbox it will display values from mysql table into dialog box's edit boxes . all values are fetched but date does not as the mysql date format is yyyy-mm-dd and the datetime picker in mfc has the format dd-mm-yyyy plz tel me how to fetch it Please mail me
-
Maybe like this:
const char * const s = "2006-06-12" ; // the date in yyyy-mm-dd format int year, month, day; sscanf(s, "%i-%i-%i", &year, &month, &day); CTime const t(year, month, day, 0, 0, 0); m_cMyDateTimePicker.SetTime(&t);
but sir wat iwill enter in place of date 2006-06-12 otherwise it will give only this date. i dont know but value stored in mysql table const char * const s = "2006-06-12" ; Please mail me
-
but sir wat iwill enter in place of date 2006-06-12 otherwise it will give only this date. i dont know but value stored in mysql table const char * const s = "2006-06-12" ; Please mail me
It was just a sample. In your application you probably get date from database with a SELECT statement, let us say "
SELECT id, name, date, count FROM myTable
" (this is just a sample). Then you usemysql_query
and finally something likeres = mysql_store_result(myDB)
. Now you can access the date value, which is the third field of the statement:char * s = row[2];
Put a breakpoint here and see if the date value is valid. Then use the previous sample to display it.
-
It was just a sample. In your application you probably get date from database with a SELECT statement, let us say "
SELECT id, name, date, count FROM myTable
" (this is just a sample). Then you usemysql_query
and finally something likeres = mysql_store_result(myDB)
. Now you can access the date value, which is the third field of the statement:char * s = row[2];
Put a breakpoint here and see if the date value is valid. Then use the previous sample to display it.
thanks a lot sir can i hav ur personel mail id if possible and u dont mind Please mail me