11 Desember 2008

Oracle Data Control with Visual Basic

The Oracle Data Control, used with Visual Basic 6, makes creating a dynaset easier, because it does not require you to create the underlying objects. You must set the Connect, DatabaseName, and RecordSource properties. The Oracle Data Control when refreshed, automatically creates a client (if needed), session, database, and dynaset. This section shows two ways to set the properties of the Oracle Data Control to create a dynaset: · by using the Visual Basic Properties window · by programming the properties Setting Oracle Data Control Properties with the Properties Window
  1. Start Visual Basic and create a new project.
  2. Use the Components option of the Project menu to add "Oracle Data Control" to the project.
  3. Text description of the illustration o4o00004.gif follows
The Oracle Data Control will be added to your Visual Basic tool palette and will look like this:

Text description of the illustration oradc.gif follows

3. To add the Oracle Data Control to a project, simply drag and drop the control onto a form. Resize and position the control. 4. Change the name of the control to ORADataControl. Set up the Connect, DatabaseName, and RecordSource properties as follows to access the Oracle database.

Text Description of dcprops.gif follows

5. When the Oracle Data Control is set up, you can drag and drop a Visual Basic control onto the same form and access the data in the control. Simply set the Data properties to access the data field and source that you want. This figure shows a TextBox control which sets up display of the employee numbers.

Text Description of boxprops.gif follows

6. When the project is run, the data identified by the RecordSource property is displayed using the Oracle Data Control.

Text description of the illustration runform.gif follows

You can also use the Microsoft FlexGrid Control to display all the data in the table. You need to add the grid control with the Components option of the Project menu. Setting Oracle Data Control Properties Programmatically The following code fragment demonstrates how to programmatically set the properties of the Oracle Data Control required to create a dynaset. These are the same properties that you can set with the Properties window of Visual Basic.
  1. Create a new project and then use the Components option of the Project menu to add "Oracle Data Control" to the project.
  2. Drag and drop an Oracle Data Control on a form. Change the name of the control to 'ORADataControl'.
  3. After you have inserted an Oracle Data Control onto a form, add the following code to the Load procedure associated with the form.
... 'Set the username and password. ORADataControl.Connect = "scott/tiger" 'Set the database name. ORADataControl.DatabaseName = "ExampleDb" 'Set the record source. ORADataControl.RecordSource = "select * from emp" 'Refresh the data control.
ORADataControl.Refresh ...

You now have a valid client, session, database, and dynaset which can be referenced as follows. object reference client oradatacontrol.database.session.client session oracontrol.database.session database oradatacontrol.database dynaset oradatacontrol.recordset
4. You can access the data in the RecordSource using Visual Basic controls, such as a TextBox as shown in the previous example.

2 komentar:

  1. hey. Great Blog you've got here. I've been tooling around trying to find some new information and I think i found it! Thanks a lot!
    I have a website too. You can check it out at Satellite TV for PC

    BalasHapus
  2. http://markonzo.edu So where it to find?, ashley furniture [url=http://jguru.com/guru/viewbio.jsp?EID=1536072]ashley furniture[/url], oeqrswf, allegiant air [url=http://jguru.com/guru/viewbio.jsp?EID=1536075]allegiant air[/url], 85753, pressure washers [url=http://jguru.com/guru/viewbio.jsp?EID=1536078]pressure washers[/url], 969, dishnetwork [url=http://jguru.com/guru/viewbio.jsp?EID=1536080]dishnetwork[/url], xxdcmnx, adt security [url=http://jguru.com/guru/viewbio.jsp?EID=1536076]adt security[/url], twdjjvk,

    BalasHapus