Detecting when a query has completed and returned a result
Although I have been working with Delphi for many years with various databases I have not particularly worked with Oracle before. Now I'm working on a project that involves MS SQL and Oracle. The problem I'm experiencing is the application is getting an ORA-01013 error (which from all the documentation seems to suggest that the user has interrupted the Oracle processing or has cancelled the query in some way) whilst allowing the user to scroll through a list of records coming from a MS SQL database. So it's as though the user is scrolling through the records (say of employees) coming from MS SQL, and in the TADOQuery AfterScroll event I'm trying to retrieve data held for that employee in an Oracle database, and the next employee is arrived at prior to Oracle returning the value for the previous one. The actual error is generated within the Oracle query when I check if the query (using DevArt's TOraQuery component) is active before changing it's parameters and then re-opening it - so:
with qry_get_employee_details_from_Oracle do
if active then active := False; --the error occurs here
paramByName('Code').AsString := an_Employee_ID;
paramcheck := True;
So my question is - how do you detect that a query has completed and has returned the relevant result set before asking it to close?
Any help would be much appreciated.
p.s. Of course I could put a button somewhere that allows the user to manually initiate the 'get employee details' query rather than have it happen on-the-fly as you move from employee to employee - but that would be less slick.