Update on HW #6/Final Exam

Homework #6 was modified and is now your final exam as well as homework. Your goal is to create the COM server, and the testing program, and also to create an ASP page that demonstrates the COM server in action.

The following is a list of points concerning the change from a homework assignment to being your final exam:

  1. You should install PWS as your web server (Go to the Start button, then Help, then search for 'Installing PWS')
  2. You should copy the ASP file (available on class web page) to your C:\INetPub\wwwroot folder.
  3. You should change the Advanced settings in PWS to enable Execute and Script access on your root folder of PWS.

In addition to the above, the following changes should be implemented into your source code to make the COM server able to be used in ASP pages:

You must use the CDatabase::NoOdbcDialog option when logging into the database. Doing this means several changes, specifically:

  1. Change your m_Client data member in your COM class from a CClientSet data member, to a CClientSet * data member named m_pClient. You will need to change all the '.' references to '->' as needed.
  2. Add a CDatabase data member to your CClient class. Call it m_DB, and in the constructor of your CClient class (the COM object), initialize both the m_DDB and the m_pClient data members:
		m_pClient = 0;
		m_DB.OpenEx(_T("DSN=MGSales"), CDatabase::noOdbcDialog);
		m_pClient = new CClientSet( & m_DB );
  1. Remember to release (delete) the m_pClient data in your destructor.

 

The noOdbcDialog flag is needed so that the ODBC system does not pop up any dialogs if not enough information were supplied for the connection. Even though we don't need to provide any additional information, the ODBC system won't recognize that up front. If we call any function in ODBC that could potentially display a dialog, that function will terminate when called by an ISAPI extension (like ASP). So, we open the m_DB database connection, and then create the recordset for client access to use the open m_DB connection.

Note: If you have problems doing the AddNew function, and MFC throws an exception when you try and perform the update, you may want to make sure that your CClientSet class is a dynaset recordset. This may be required for some older Access database ODBC drivers. Change the line in the CClientSet Constructor that changes m_nDefaultType to look like the following:

	m_nDefaultType = dynaset;