This article was previously published under Q173645
This article has been archived. It is offered "as is" and will no longer be updated.
When using the compiler #import feature, ADO, the OLE DB 1.1 ODBC Provider,and trapping _com_error exceptions, an access violation occurs inMSDAER.DLL when closing an application.
A method created with #import can throw a _com_error exception. When itthrows the exception, Release() is not called on the IErrorInfo pointerwhich is returned from GetErrorInfo(). This leaves the internal errorobject in the OLEDB ODBC Provider stranded which causes the accessviolation to occur as the application shuts down.
Create a macro which can be used to Release() the IErrorInfo interface atthe end of the "catch" block. For example: