OLE DB Samples

Rowset Viewer Example

This example describes how to connect to a provider, execute a command, and use IOpenRowset. It may be necessary to configure the ODBC data source before connecting to the provider. Use the ODBC Data Source Administrator to create or select a File DSN and supply the UserID and Password as appropriate. (OLE_DB_NWind_Jet is no longer available from this installation as a sample database.)

To connect to a provider

  1. Start RowsetViewer.exe.
  2. From the File menu, choose Full Connect.
  3. Select MSDASQL as the provider and select your ODBC data source for the DataSource parameter.
  4. Click OK.

To execute a command

  1. In the top pane of the MDI child window, type a query—for example:
    SELECT * FROM CUSTOMERS
  2. Click the SQL button on the toolbar to run ICommand::Execute, or open the Command menu, select ICommand, and then click Execute. The ICommandExecute::Execute dialog box appears.
  3. Click OK.

To use IOpenRowset

  1. In the top pane of the MDI child window, type the name of a table in your data source—for example, CUSTOMERS.
  2. Make sure you are connected to a provider and click the ! button, or open the Session menu, select IOpenRowset, and then click IOpenRowset::Open Rowset.