02-02-2010 09:22 AM
I have a table that looks like this
Item_number Active Test Specifications ....
1111 0
2222 1
3333 1
4444 1
If I run after opening the database.
iTableHandle = DBActivateSQL(iDatabaseHandle, "SELECT * FROM tblTest WHERE Active = 1 AND ItemNumber = '5555'");
DBActivateSQL returns a 3 same value if I replaced 5555 with 4444.
Shouldn't DBActivateSQL return an error since it did not find anything? I want to fail if the user enters the wrong itemnumber or one that is inactive.
Solved! Go to Solution.
02-03-2010 08:33 AM
Paul,
I don't think the function should give an error, it's just not finding anything. It would give an error if your SQL statement was malformed or if you were trying to access a column that doesn't exist, but not if your WHERE clause returns no values. You'd need to set up your DBBinds, then call DBFetchNext. You could have some logic in your code to display an error if the first call to DBFetchNext didn't return 0 (indicating no records were found) and then allow your user to enter a different number.
09-07-2021 02:56 AM
You can use this:
DBActivateSQL(iDatabaseHandle, "SELECT * FROM tblTest WHERE Active = 1 AND ItemNumber = '5555'");
if (DBNumberOfRecords (iTableHandle )==0)
MessagePopup("SQL Error","No records found");