accessing database using ado dc(employee information system) & report generation
TRANSCRIPT
-
8/10/2019 Accessing Database Using Ado Dc(Employee Information System) & Report Generation
1/14
CREATING DATABASE APPLICATION WITH ORACLE & VISUAL BASIC
STEP 1: Create a Table Emp
SQL> desc emp;Name Null? Type----------------------------------------- -------- -----------------
EMPNO NUMBER(6)ENAME NOT NULL AR!"AR#(#$)%OB AR!"AR#(#$)M&R NUMBER(')EPTNO NUMBER()SALAR* NUMBER(+,#)
STEP2: Design a Form Employee
-
8/10/2019 Accessing Database Using Ado Dc(Employee Information System) & Report Generation
2/14
STEP 3
Accessing Database using ADODC.
. /01s sec/12. 3e 31ll lea4. /2 use /0e Rem2/e a/a Access O5ec/ /0a/ 1s /0e AO ! da/a25ec/7 8e 31ll 1llus/4a/e us1.9 /0e c2./42l /2 c2..ec/ /2 a O4acle a/a5ase a.d s2me em2
/a5les 2. /0e Sc2// use4 1. O4acle 5ase7
Setting up te ADO Control.
:7 Ope. 1sual Bas1c, s/a4/ a .e3 p42ec/7#7 O. /0e me.u /a5 2P42ec/7 !l1c< !2mp2.e./s (!TRL=T) 77 N23 add /0e c2./42l >M1c42s2/ AO a/a !2./42l (OLEB)
A!! an ADO Data Control to te "orm using te ADODC tool # $
%o& rigt clic' on te ADO control an! select ADODC Properties7
-
8/10/2019 Accessing Database Using Ado Dc(Employee Information System) & Report Generation
3/14
N23 1/ 31ll 1.2
-
8/10/2019 Accessing Database Using Ado Dc(Employee Information System) & Report Generation
4/14
a/e4 /01s p4ess /0e 5u//2. /es/ c2..ec/12. 7 /0e use4.ame a.d pass324d 1s al1d, /0e. amessa9e 52 31ll appea47
tip : c0ec< /0e all23 sa1.9 pass324d, 2/0e431se 2. ee4y 4u. /1me s/a4/, 1/ 31ll as< 24 apass324d7
A/e4 /01s, p4ess O< 1. /0e ma1. d1al29 527
O.ce a9a1. 1. /0e P42pe4/y Pa9es, !l1c< 2. /0e Rec24dS2u4ce Ta57 Selec/ !2mma.d Type42m/0e d42p d23. 527
-
8/10/2019 Accessing Database Using Ado Dc(Employee Information System) & Report Generation
5/14
N23 42m /0e d42p d23. l1s/ 2 Ta5le 24 S/24ed P42cedu4e Named42p d23. 52, selec/ /0eTa5le EMP
Fe& %otes on Comman! Type meto!s-adcmdTe/
T0e S2u4ce s/41.9 c2./a1.s a SQL c2mma.d, suc0 as a selec/ s/a/eme./7
-ad!mdTa5le
T0e S2u4ce s/41.9 c2./a1.s /0e .ame 2 a /a5le /2 5e 4e/41eed7 (AO 1/sel c4ea/es /0eDue4y 31/02u/ /0e use4 see1.9 1/)7 Us1.9 /01s 2p/12. 1s .2/ su1/ed 24 la49e /a5les as 1/c2./a1.s all /0e 4ec24ds, a.d /0us 0a.dl1.9 may 5ec2me cum5e4s2me7 Use 1/ 2.ly 24small /a5les l1
-
8/10/2019 Accessing Database Using Ado Dc(Employee Information System) & Report Generation
6/14
STEP 5
Add the co((and control# #%ch a# ADDNEW- SAVE- DELETE- UPDATE
Wr"te the E.ent cod"n /0 cl"c)
Pr".ate S%/ Co((and1Cl"c)23
Adodc,Record#et,AddNe+
End S%/
Pr".ate S%/ Co((and41Cl"c)23Adodc,Record#et,Delete
5#Box 6Record Deleted6
End S%/
Pr".ate S%/ Co((and71Cl"c)23
Adodc,Record#et,U!date
End S%/
Pr".ate S%/ Co((and81Cl"c)23Adodc,Record#et,Sa.e
End S%/
-
8/10/2019 Accessing Database Using Ado Dc(Employee Information System) & Report Generation
7/14
STEP 6
Add the co((and control# #%ch a# 5OVE 'IRST- 5OVE NE9T- 5OVE PREVIOUS AND 5OV
LAST
Wr"te the E.ent cod"n /0 cl"c)
Pr".ate S%/ Co((and:1Cl"c)23
Adodc,Record#et,5o.e'"r#t
End S%/
Pr".ate S%/ Co((and;1Cl"c)23
Adodc,Record#et,5o.eNext
End S%/
Pr".ate S%/ Co((andect /0 ':
-
8/10/2019 Accessing Database Using Ado Dc(Employee Information System) & Report Generation
8/14
REPORT GENERATION
STEP 1: ADDING DATA REPORT
Start V"#%al Ba#"c a# a Standard E9E !ro>ect, 'ro( the Pro>ect (en% "n the VBE- #elect Add Data Re!ort
"n the dro!do+n (en%, No+- 0o% +"ll /e !re#ented +"th the data re!ort en."ron(ent- a# #ho+n "n '"%re
The data re!ort en."ron(ent conta"n# #"x control#- the0 are R!tTextBox- R!tL"ne- R!t'%nct"on-
R!tLa/el- R!tI(ae and R!tSha!e,
?o% can c%#to("@e 0o%r re!ort here /0 add"n a t"tle to the !ae header %#"n the re!ort la/el R!tLa/el,
S"(!l0 dra and dra+ the R!tLa/el control on the data re!ort de#"ner +"ndo+ and %#e the Ca!t"on
!ro!ert0 to chane the text that #ho%ld /e d"#!la0ed, ?o% can al#o add ra!h"c# to the re!ort %#"n the
(pt)mage control.
STEP 2: CONNECTING THE REPORT TO DATABASE USING DATA ENVIRON5ENT
DESIGNER
Cl"c) the Pro>ect (en%- then #elect Data En."ron(ent, *ro( the dro!do+n (en%, The de*a%lt data
en."ron(ent +"ll a!!ear- a# #ho+n "n *"%re
-
8/10/2019 Accessing Database Using Ado Dc(Employee Information System) & Report Generation
9/14
-
8/10/2019 Accessing Database Using Ado Dc(Employee Information System) & Report Generation
10/14
Select Pro."der 5"cro#o*t OLE DB Pro."der *or Oracle
Cl"c) Next,
Select the Connect"on, Enter Ser.er Na(e- U#erNa(e & Pa##+ord,
Al#o Choo#e Allo+ Sa."n Pa##+ord & Pre## O) B%tton,
-
8/10/2019 Accessing Database Using Ado Dc(Employee Information System) & Report Generation
11/14
Step 3: (etrie*ing )n"ormation "rom te Database
. 24de4 /2 use /0e da/a5ase 1. y2u4 4ep24/, y2u .eed /2 c4ea/e Due4y /2 4e/41ee /0e 1.24ma/12. 42m /0e da/a5ase7"e4e , 3e 31ll use SQL c2mma.d /2 c4ea/e /0e Due4y7 14s/ 2 all, 4190/ cl1c< 2. My!2..ec/12. /2 add a c2mma.d /2/0e da/a e.142.me./7
Select Co((and Pro!ert"e#
-
8/10/2019 Accessing Database Using Ado Dc(Employee Information System) & Report Generation
12/14
-
8/10/2019 Accessing Database Using Ado Dc(Employee Information System) & Report Generation
13/14
-
8/10/2019 Accessing Database Using Ado Dc(Employee Information System) & Report Generation
14/14
STEP 4$ R%n the Re!ort,