Subject | IB_Cursor question (fwd) |
---|---|
Author | Tools for Schools |
Post date | 2004-10-07T11:32:19Z |
Hi All,
I'm forwarding this on behalf of "Tools for Schools", who has some
trouble posting to the list (probably client config).
Grtz, Paul Vinkenoog
---------- Forwarded message ----------
Date: Thu, 7 Oct 2004 13:07:24 +0200 (MEST)
From: ToolsForSchools <T4S@...>
To: Paul Vinkenoog <paul@...>
Subject: Vraag over IB_Cursor
Hi All,
I've got a listbox of customers. Multiple details (about 10 rows) are
fetched from the database as
soon as the users clicks a customer and put into edits.
If the user clicks another customer before fetch of the previous
details is
finished the error "Dataset is currently fetching"
Apparently IBO fetches in a separate thread.
The code :
Procedure TMyClass.GetCustomerDetails(CustId: String)
begin
FQry.SQL.Clear;
FQry.SQL.Add('Select * From CustomerDetails');
FQry.SQL.Add('Where FK_Cust = ' +CustId );
FQry.Open;
FQry.FetchAll;
FQry.Close;
end
In the AfterFetchRow I fill the edits.
I tried the next code, but it didn't work
Procedure TMyClass.GetCustomerDetails(CustId: String)
begin
FQry.SQL.Clear;
FQry.SQL.Add('Select * From CustomerDetails');
FQry.SQL.Add('Where FK_Cust = ' +CustId );
while FQry.Active do
Sleep(50);
FQry.Open;
FQry.FetchAll;
FQry.Close;
end
also tried
Procedure TMyClass.GetCustomerDetails(CustId: String)
begin
FQry.SQL.Clear;
FQry.SQL.Add('Select * From CustomerDetails');
FQry.SQL.Add('Where FK_Cust = ' +CustId );
if FQry.Fetching then begin
FQry.AbortFetching;
while FQry.Fetching do
Sleep(100);
end;
if FQry.Active then
FQry.Close;
FQry.Open;
FQry.FetchAll;
FQry.Close;
end
Looking in AbortFetching its just set a flag and returns immidiately?!
In TIB_Dataset.SysFetchAll its reacts on this flag, but AbortFetching
has returned meanwhile.
Where am I wrong ?
The best solution is to terminate the cusor from fetching instead of
sleeping. But how?
I'm forwarding this on behalf of "Tools for Schools", who has some
trouble posting to the list (probably client config).
Grtz, Paul Vinkenoog
---------- Forwarded message ----------
Date: Thu, 7 Oct 2004 13:07:24 +0200 (MEST)
From: ToolsForSchools <T4S@...>
To: Paul Vinkenoog <paul@...>
Subject: Vraag over IB_Cursor
Hi All,
I've got a listbox of customers. Multiple details (about 10 rows) are
fetched from the database as
soon as the users clicks a customer and put into edits.
If the user clicks another customer before fetch of the previous
details is
finished the error "Dataset is currently fetching"
Apparently IBO fetches in a separate thread.
The code :
Procedure TMyClass.GetCustomerDetails(CustId: String)
begin
FQry.SQL.Clear;
FQry.SQL.Add('Select * From CustomerDetails');
FQry.SQL.Add('Where FK_Cust = ' +CustId );
FQry.Open;
FQry.FetchAll;
FQry.Close;
end
In the AfterFetchRow I fill the edits.
I tried the next code, but it didn't work
Procedure TMyClass.GetCustomerDetails(CustId: String)
begin
FQry.SQL.Clear;
FQry.SQL.Add('Select * From CustomerDetails');
FQry.SQL.Add('Where FK_Cust = ' +CustId );
while FQry.Active do
Sleep(50);
FQry.Open;
FQry.FetchAll;
FQry.Close;
end
also tried
Procedure TMyClass.GetCustomerDetails(CustId: String)
begin
FQry.SQL.Clear;
FQry.SQL.Add('Select * From CustomerDetails');
FQry.SQL.Add('Where FK_Cust = ' +CustId );
if FQry.Fetching then begin
FQry.AbortFetching;
while FQry.Fetching do
Sleep(100);
end;
if FQry.Active then
FQry.Close;
FQry.Open;
FQry.FetchAll;
FQry.Close;
end
Looking in AbortFetching its just set a flag and returns immidiately?!
In TIB_Dataset.SysFetchAll its reacts on this flag, but AbortFetching
has returned meanwhile.
Where am I wrong ?
The best solution is to terminate the cusor from fetching instead of
sleeping. But how?