steibeldj
April 26th, 2005, 04:04 PM
I have an application in MFC that I have added some ADO.NET code to.
My DatabaseAccess class is unmanaged and has pointers to OleDbConnection which is used in the class member functions to manipulate the database.
I also have an unmanaged CFormView class that includes the DatabaseAccess class as a member.
I declared a pointer to the CFormView class so that other places in the code have access. CFormView * theDialog;
When I call the member functions in the DatabaseAccess classs, the OleDbConnection is checked for NULL to make sure the connection is there. All calls to the DatabaseAccess member functions work from the CFormView class.
When in CMainFrame on a timer I call theDialog->UpdateRecord() which in turn calls an OpenDatabase member of my DataAccess class, the check if(m_OleDb_connection != 0) causes an NullReferenceException to be thrown and the debugger shows that no instance of the connection has been assigned to the variable holding the OleDbConnection.
I thought this might have something to do with pinning or Threads. Any suggestions?
My DatabaseAccess class is unmanaged and has pointers to OleDbConnection which is used in the class member functions to manipulate the database.
I also have an unmanaged CFormView class that includes the DatabaseAccess class as a member.
I declared a pointer to the CFormView class so that other places in the code have access. CFormView * theDialog;
When I call the member functions in the DatabaseAccess classs, the OleDbConnection is checked for NULL to make sure the connection is there. All calls to the DatabaseAccess member functions work from the CFormView class.
When in CMainFrame on a timer I call theDialog->UpdateRecord() which in turn calls an OpenDatabase member of my DataAccess class, the check if(m_OleDb_connection != 0) causes an NullReferenceException to be thrown and the debugger shows that no instance of the connection has been assigned to the variable holding the OleDbConnection.
I thought this might have something to do with pinning or Threads. Any suggestions?