Oracle Objects for OLE
Release 9.0.1

Part Number A90173-01

Home

Book List

Contents

Master Index

Feedback

Using the Oracle Data Control with MS VC++

This example shows how to create a simple Win32 Application with the Oracle Data Control using MS VC++. This example assumes that both the Oracle Data and DB Grid controls have been registered on the system.

  1. Start the Microsoft Visual C++ program.

  2. Select New from the File Menu.

  3. In the Projects Tab of the New Window select MFC AppWizard. Enter a project name, such as OO4O, and determine the location of the project. Select Create.

  4. In the first page of the MFC AppWizard, select dialog based application, then select Next.

  5. In page 2 of the wizard, make sure the ActiveX Controls box is checked, accept the default checks, and enter a title for the project.

  6. In page 3 of the wizard, accept the defaults.

  7. In page 4, select finish. Select OK at the New Project Information screen.

  8. In the Project Workspace dialog box, select the ResourceView tab. Expand the Resources folder, then expand the Dialog folder.

  9. Double-click on the main project dialog box to allow you to edit the dialog. Note: If you used OO4O as the project name, it would be named IDD_OO4O_DIALOG.

  10. Delete the default controls that are on the dialog. Resize the dialog to make it larger.

  11. With the dialog selected, press the right mouse button to display the pop-up menu. Select Properties from the menu. In the General tab of the Properties window, change the caption to Oracle Data Control Example. Close the properties window.

  12. With the dialog selected, press the right mouse button to display the pop-up menu. Select Insert ActiveX control from the menu. Select Oracle Data Control in the window and then select OK.

    oradcins.gif

    Text description of the illustration oradcins.gif

  13. Position the Oracle Data Control at the bottom of the dialog. With the data control selected, press the right mouse button to display the pop-up menu. Select properties from the menu.

  14. In the General tab of the Properties window, change the ID to IDC_ORADATACONTROL. Remove the check for Visible so the control is hidden when the application is run.

  15. Display the All tab of the Properties window and set the following:

Connect: scott/tiger

Database: exampledb

RecordSource: select * from emp

oradcprp.gif

Text description of the illustration oradcprp.gif

16. With the dialog selected, press the right mouse button to display the pop-up menu. Select Insert ActiveX control from the menu. Locate the DB Grid Control and select OK.

17. Position the DB Grid Control at the top of the dialog and resize. Display the properties for the control. In the All tab of the Properties window, set the DataSource property to the Oracle Data Control (IDC_ORADATACONTROL). Accept the defaults for the other properties for now. These can be changed later.

18. Select Save All from the File Menu.

19. Build and Execute the project.

20. The DB Grid displays the records from the
emp table as in the following illustration.

oradcemp.gif

Text description of the illustration oradcemp.gif


 
Oracle
Copyright © 1996-2001, Oracle Corporation.

All Rights Reserved.

Home

Book List

Contents