Oracle Database Connectivity

This is a GUI based data entry application which shows how to add, modify and delete records using Oracle Database.


Description

This is a GUI based data entry application which shows how to add, modify and delete records using Oracle Database. This also shows how to use the ErrorProvider for validations.

There are many applications which have been developed using SQL Server. However, there are many people using Oracle as a database. So, in this article I'll show how an Oracle database is accessed.

What will you need?

For this application you'll have to download and install Oracle.NET from the Microsoft site. Of course, Microsoft.NET is needed.

Table Name : test

Table structure :

empno varchar2(10),
empname varchar2(30),
empsal number,
email varchar2(100)

How does this application work?

The logic that I have employed here is slightly different. One thing you will notice is that there is no button for adding a record. When the application is started, the Emp No field has focus. Now, when you enter an existing employee number, the rest of the details are shown and the focus shifts to the 'Modify' button. At this point you can choose to either modify or delete the record. However, if the record does not exist it flashes an error message. To add a record, you simply have to leave the emp no field blank, enter the rest of the fields and save the record. The employee number is auto generated and is flashed on the screen for the operator's info.

Things to consider :

Even after you have installed Odbc.NET and added it to the General Assemble Cache(GAC) (see the Odbc.NET documentation on how to add System.Data.Odbc.dll to the GAC), you will still have to give reference to it while compiling.

Note :

The path in which you've installed Odbc.NET may differ from the path of System.Data.Odbc.dll in compile.bat. In such a case, you will have to make the necessary changes in the batch file. Also, you can create your own DSN and make the necessary changes in the 'DatabaseGUI.cs' file.