Products:
BCB 4 professional
MySQL latest
MyODBC latest
Here's the code I'm using
bool AnAuthor::CheckIfExists(int p_ID) {
TQuery *CheckAuthor = new TQuery(NULL);
AnsiString strQuery;
bool retVal;
strQuery = "SELECT COUNT(*) AS AUTHORCOUNT FROM AUTHORS WHERE
AUTHOR_ID=" + AnsiString(p_ID);
CheckAuthor->DatabaseName = "bookcollection";
CheckAuthor->SQL->Add(strQuery);
CheckAuthor->Open();
if (CheckAuthor->FieldByName("AUTHORCOUNT")->AsInteger >= 1) {
retVal = true;
} else {
retVal = false;
}
delete CheckAuthor;
return retVal;
}
This way, it retrieves the recordcount exactly, but if I use
CheckAuthor->RecordCount
instead of:
CheckAuthor->FieldByName("AUTHORCOUNT").AsInteger
I get a nonsense answer.
John Meyer
[EMAIL PROTECTED]
Programmer
If we didn't have Microsoft, we'd have to blame ourselves for all of our
programs crashing
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php