Tuesday, 25 October 2016

ADO Stored Procedure Blank Record Issue Fixed

I recently had an issue where I had an ADO stored procedure (TADOStoredProc) that returned a single record from a SQL Server database and the first time it was open it worked fine, however the second time it appeared to return a blank record. After some investigation it appeared the record count was 1, but the recno value was -1.

It appears that when you 'open' the stored procedure it is not guaranteed to position the record pointer on the first record. The solution is to simply call 'first' just after calling 'open'.

No comments:

Post a Comment