Click to open or copy the DBViewer project files.
The DBViewer sample is an enhancement of the MFC DAOVIEW sample. It demonstrates a mid-level application that relies on the OLE DB Template CManualAccessor class. This sample illustrates how to take full control of the bindings and use them for your applications.
Once you are connected to a data source via the enumerator support, you can manipulate the data, call the stored procedures, and view the schema information. The tree view on the left side of the application window displays the tables and the stored procedures. To view or modify data, right click a table or a stored procedure, and a shortcut menu will appear with additional operations.
This sample contains a lot of code to support stored procedures. However, you will find that not all stored procedures will run under this sample. This is because the underlying ODBC Drivers do not provide support for some OLE DB methods. DBViewer does support multiple-result sets. If you click the list view where the data is located, you may see the multiple result sets button highlighted on the toolbar. You can click it and obtain the next result set.
DBViewer demonstrates how to use the error information in your application. The CErrorsDialog handles the IErrorRecords interface and displays the error information returned from a particular call.
You can use DBViewer with the ODBC provider, and with the Microsoft Access97 and Microsoft SQL Server 6.5 databases; however, DBViewer cannot handle SQL Server stored procedures with integer parameters, or with names consisting of more than one word, for example, 'My stored procedure'. You will get errors in these cases.