I am getting an access violation (faulted with message 'access violation at 0x4da2ef6d: read of address 0xeeaed7e8') when exiting my Delphi 7 application. This only happens when a particular TQuery component (used to query a SQL Server db and populate a tabsheet) is opened *after* a TStoredProc object's ExecProc method has been called. No access violation occurs when exiting the application if:
- ExecProc was not called (doesn't matter how many times the query was opened)
- That specific query was not opened after ExecProc was called
Weird thing is, the problem only occurs with a particular TQuery, but seems to happen after *any* TStoredProc's ExecProc method has been called. I am explicity closing the query before opening it, setting the TStoredProc to inactive after calling, and closing all database connections. I have also removed references to components such as the Crystal VCL, but the problem persists. I trace into the code and it gets to the 'end.' line of the project code (source) and then I get the access violation(!)
Any ideas why this might be happening? I have tried everything I can think of but haven't found a solution, short of avoiding the triggering sequence of events altogether. Please help! Thanks in advance.