Using Oracle Developer Tools with Visual Studio - Displaying Data from the Employees Table
(Page 5 of 5 )
Add a form Data.vb to the same project, and drag and drop the Employees table from the Oracle Explorer to the data form. This adds the employeesOracleDataAdapter1 icon followed by the same previous message. When you click Yes to this message the employeesOrcleConnection1 will also be added. We will use the Oracle Data Reader object to read the EmployeeID, First Name, and Last Name and display them in the list box. For this purpose add a ListBox and a command button as shown.

In a manner similar to what was done with Form1, add an imports statement at the top of the data form's code page. To the click event of the button, insert the code shown in the next picture.

The following sequence of code execution takes place when the command button is clicked: after instantiating a connection it will be assigned the employeesOracleConnection1. The connection then opens. A new Oracle data adapter gets instantiated. It will be assigned to the employeesOracleDataAdapter1. This adapter's select command will be assigned the SQL statement to get all fields from the Employees table. The OracleDataReader grabs the executed SelectCommand. While the data in the reader is being read, the ListBox gets populated. Before terminating this event, the reader and the connection are both closed. The display shown next appears after you click on the OK button to the message box, which says that the OracleDataReader does have data denoted as True by the Boolean.

Summary
Oracle Data Tools add a comprehensive set of tools to the Visual Studio IDE, only a very small subset was explored in this basic tutorial. The ODT gives full support for most of the activities that one can can do on the Oracle Server such as working with stored procedures, making changes to the tables, views, and so forth. Although the ODT are added to several versions of VS 2003, to exploit the full capability of this resource one may require the Professional or Enterprise version of VS 2003. The drag and drop feature adds to the RAD capability immensely. Although in this tutorial code was used to make a connection and display data, the same could be done during design time, reducing the code even more. The password was shown in the display for no good reason, but in a production scenario it is of course serious.