When you use the SQL_RunSQLSel function, it is useful to know whether the SELECT statement resulted in an empty recordset. You can test for this condition using the SQL_LastFullErr function.
The following example assumes that you have already connected to RPG2SQL PC Component, you have received a socket in variable SQL_Socket, and you have an indicator variable hasRecords. Use the following code to run the SELECT statement and check whether there are any rows in the recordset:
Rtn = SQL_RunSQLSel(SQL_Socket : 'select * from NameAddr where first = ''James''');
// ADO/SQL database operation "failed"
If Rtn = -1;
// If no error is reported, then the recordset is empty
If SQL_LastFullErr(SQL_Socket) = '0';
hasRecords = *off;
Last Modified On:
No, open a new Support Case
You don't have the appropriate permissions.