Unknown isc error 0 on Delphi XE TClientDataSet.Next

I have a data structure while connecting DBXpress to Firebird database. In a specific part of the system, I add data splitting by combination of ClientDataSet, DataSetProvider and SQLQuery. It worked well, but lately it started raising an unknown isc error 0 error when I run Next on the ClientDataSet after various correct calls. The way I am using to do the pagination is:

if not ClientDataSet.Active then
    ClientDataSet.Open;
RecNo := ClientDataSet.RecNo; // I need to preserve the actual selected register too
ClientDataSet.DisableControls;
LastRecNo := GetLastRecNo; // This just discover the last RecNo that i have previously stored. This cares about DataSet.Eof too, returning -1
if LastRecNo > -1 then
begin
    ClientDataSet.RecNo :=  LastRecNo;
    ClientDataSet.Next; // LastRecNo is already processed
    while (not ClientDataSet.Eof) and (Result < DATA_PAGE_SIZE) do
    begin
         // ... Process record, not important here ...
         ClientDataSet.Next; // The exception is raised here
         Inc(Result);
    end;
end;
ClientDataSet.RecNo := RecNo; // Back to selected register
ClientDataSet.EnableControls;

      

This code is called multiple times (for example 15 times) and no exception is thrown, otherwise it is thrown and an exception is thrown. Does anyone know why this is happening?

I read that there might be problems connecting to the database, but the database is on localhost, the connection string I am using is like "localhost: C: \ Path \ Base.FDB".

EDIT: This code runs when the user scrolls down on the mouse, moves down the scrollbar, or moves to items near the end of the list. In recent tests, I found that if I stop with a breakpoint on all these calls, then I can get all the records, the exception will not be raised. I'm pretty sure I don't have another thread modifying the ClientDataSet.

+3


source to share





All Articles