Access violation on refresh/close of table

kcscarp

Member
Hello,

I am writing an application on a Windows 7 machine using Delphi 2010, DOA 4.1.2.2, and Oracle 11g.

I am running a "refresh" command on a TOracleDataSet object shortly after inserting a new record. The insertion works fine. I put in a break point and opened PL/SQL Developer to see if the new record was there, and it was, looking just as it should.

However, when I try to refresh the TOracleDataSet object so that the new record is visible, I am getting an access violation error.

I tried replacing the "refresh" with a "close" followed by an "open", and got the same access violation error. The error appears to be triggered on the "close".

The strangest part is that this sequence of code works several times before failing in exactly the same point (my application reads in an XML survey, displays it, and saves the answers in the Oracle database. The failure is always on the same question. I tried rearranging the questions, and the failure occurred on the new question in the same position).

Any suggestions on what to do would be most welcome. Debug messages, etc. are listed below.

Best regards,

Chris

--------------------------------------------------------

Here is the code snippet:


try
dmSurvey.qryNewQuestionRec.Execute;
dmStaff.sessMain.Commit;
except on E: Exception do ShowMessage('Unable to execute query qryNewQuestionRec');
end;

with dmSurvey.dsoraQuestions do
begin
Refresh; //
 
A question --- I understand from the manual that a Refresh is done by closing and then re-opening the table. If the table being refreshed is a master table, are the detail tables closed and re-opened as well?

If so, that might be a clue to what is going on. I had an event procedure that I suspect was keeping a detail table open.
 
A refresh does not close and reopen. It does the following:

1. Post detail records if necessary.
2. Re-execute the query and repopulate the result set
3. Synchronize the detail datasets if necessary.
 
Thanks, Marco. I did a review of all of my UI object event code and removed all calls to "Refresh" or "Open" from the OnChange events. This appears to have solved the problem.

Thanks so much for you help.

Chris
 
Back
Top