Accessing Database Using Ado DC (Employee Information System) & Report Generation
Accessing Database Using Ado DC (Employee Information System) & Report Generation
NUMBER(6)
NOT NULL VARCHAR2(20)
VARCHAR2(20)
NUMBER(4)
NUMBER(3)
NUMBER(7,2)
STEP 3
Accessing Database using ADODC.
In this section we will learn to use the Remote Data Access Object that is the ADO DC data
object. We will illustrate using the control to connect to a Oracle Database and some Demo
tables on the Scott user in Oracle Dbase.
Setting up the ADO Control.
1. Open Visual Basic, start a new project.
2. On the menu tab of Project. Click Components (CTRL+T) .
3. Now add the control >Microsoft ADO Data Control (OLEDB)<
Add an ADO Data Control to the form using the ADODC tool [
Now right click on the ADO control and select ADODC Properties.
Now it will invoke the Property Pages for the ADO DC control that you added. Select the option
use Connection String and then click at the Build button.
Connection to a database.
Now a another dialog Data Link Properties pops up. Select Microsoft OLE DB provider
for Oracle from that list that appears and click on the Next Button.
Now if you are on a single system you dont have to Enter the Server name in the entry field.
Just enter the demo Username :Scott and password: tiger.
after this press the button test connection . If the username and password is valid, then a
message box will appear.
tip : check the allow saving password, otherwise on every run time start, it will ask for a
password.
After this, press Ok in the main dialog box.
Once again in the Property Pages, Click on the RecordSource Tab. Select Command Type from
the drop down box.
Now from the drop down list of Table or Stored Procedure Name drop down box, select the
Table EMP
STEP 4
Select the text control and change the properties as:
Data Source : Adodc1
Date Field : EmpNo
Like assign all text field with adodc for connect data source to text controls.
STEP 5
Add the command controls such as ADDNEW, SAVE, DELETE, UPDATE
Write the Event coding by click
STEP 6
Add the command controls such as MOVE FIRST, MOVE NEXT, MOVE PREVIOUS AND MOV
LAST
Write the Event coding by click
STEP 7
Run you project by F5
REPORT GENERATION
STEP 1: ADDING DATA REPORT
Start Visual Basic as a Standard EXE project. From the Project menu in the VBE, select Add Data Report
in the dropdown menu. Now, you will be presented with the data report environment, as shown in Figure
The data report environment contains six controls, they are RptTextBox, RptLine, RptFunction,
RptLabel, RptImage and RptShape.
You can customize your report here by adding a title to the page header using the report label RptLabel.
Simply drag and draw the RptLabel control on the data report designer window and use the Caption
property to change the text that should be displayed. You can also add graphics to the report using the
RptImage control.
DATA ENVIRONMENT
Click the Project menu, then select Data Environment. from the drop-down menu. The default data
environment will appear, as shown in figure