lecture on vb.net with oracle database
TRANSCRIPT
-
7/26/2019 Lecture on VB.net With Oracle Database
1/71
VB.Net SeminarJONI NEIL B. CAPUCAOMaster of Information Technolog
Instit!te of Information Technolog
College of Arts an" Sciences
Parti"o State Uni#ersit
$e%r!ar &'(&)* &+,-
-
7/26/2019 Lecture on VB.net With Oracle Database
2/71
-
7/26/2019 Lecture on VB.net With Oracle Database
3/71
Part I Morning Session/
Lesson ,. Intro"!ctionMicrosoft .NET
Vis!al St!"io &+,&Vis!al St!"io Integrate" 0e#elo1ment En#ironmentCreating an" Sa#ing Pro2ectsActi#it ,
Lesson &. B!il"ing InterfacesC!stomi3ing $ormsA""ing Controls to the $ormActi#it &
Lesson 4. 5riting the Co"eUn"erstan"ing Proce"!res an" $!nctions6an"ling ErrorsActi#it 4
-
7/26/2019 Lecture on VB.net With Oracle Database
4/71
Part II Afternoon Session/
Lesson 7. 5or8ing 9ith Oracle 0ata%ase Creating an" Managing !sers Oracle 0ata Pro#i"er for .Net Acti#it 7
Lesson :. Creating Connection to Oracle 0ata%ase a""ing 1ro2ect references to s!11ort Oracle class li%raries in
o!r .NET 1ro2ect Creating Oracle 0ata%ase connection strings
5or8ing 9ith Connection* Comman"* an" 0ata;ea"er
-
7/26/2019 Lecture on VB.net With Oracle Database
5/71
Lesson ,.
Intro"!ction
-
7/26/2019 Lecture on VB.net With Oracle Database
6/71
5hat is Microsoft .NET>
.NET re1resents an a"#ance" ne9 generation of soft9are
that 9ill "ri#e the Ne=t ?eneration Internet. Its 1!r1oseis to ma8e information a#aila%le an time* an 1lace* an"on an "e#ice.
@!ic8 0efinition
.NET is an initiati#e to integrate all Microsoft 1ro"!cts 9ith theNe=t ?eneration 9e%.
htt1
-
7/26/2019 Lecture on VB.net With Oracle Database
7/71
5hat is Microsoft .NET> Cont./
Core com1onents of .NET are
.NET Infrastr!ct!re an" Tools .NET Enter1rise Ser#ers
S@L &+++
E=change &+++
ISA &+++
6ost Integration Ser#er &+++
A11lication Center &+++
Bi3Tal8 Ser#er &+++
Commerce Ser#er &+++
.NET $rame9or8
Vis!al St!"io.NET
5in"o9s.NET
-
7/26/2019 Lecture on VB.net With Oracle Database
8/71
Core com1onents of .NET contD/
.NET Ser#ices
An integrate" set of %!il"ing %loc8 ser#ices for the ne9Internet* incl!"ing Pass1ort.NET for !ser a!thentication/* an"
ser#ices for file storage* !ser 1reference management*
calen"ar management* an" man others.
.NET User E=1erience A %roa"er* more a"a1ti#e !ser e=1erience* 9here information is
"eli#ere" in a #ariet of 9as on a #ariet of "ifferent "e#ices.
.NET 0e#ice Soft9are Ena%les a ne9 %ree" of smart Internet "e#ices that can le#erage 5e%
Ser#ices
htt1
-
7/26/2019 Lecture on VB.net With Oracle Database
9/71
-
7/26/2019 Lecture on VB.net With Oracle Database
10/71
.NET $rame9or8 is a software frameworkdeveloped by Microsoftthat runs
primarily on Microsoft Windows.
provides language interoperability(each language can usecode written in other languages) across several
programming languages. (CLR)
t includes a large class libraryknown as !ramework Class
Library(!CL) and
"rograms written for .#$% !ramework e&ecute ina softwareenvironment known as
Common Language Runtime(CLR)' an application virtual
machinethat provides services such as security' memory
management' and e&ception handling.
!CL and CLR together constitute .#$% !ramework.
-
7/26/2019 Lecture on VB.net With Oracle Database
11/71
The .NET $rame9or8
-
7/26/2019 Lecture on VB.net With Oracle Database
12/71
Common Lang!age ;!ntime CL;/
A common r!ntime for all .NET lang!ages
Common t1e sstem Common meta"ata
Interme"iate Lang!age IL/ to nati#e co"e com1ilers
Memor allocation an" gar%age collection
Co"e e=ec!tion an" sec!rit
O#er ,: lang!ages s!11orte" to"a C* VB* Jscri1t* Vis!al CFF from Microsoft
Perl* Pthon* Smalltal8* Co%ol* 6as8ell* Merc!r* Eiffel* O%eron*
O3* Pascal* APL* CAML* Scheme* etc.
-
7/26/2019 Lecture on VB.net With Oracle Database
13/71
Common Lang!age ;!ntime CL;/( contD
Ena%les cross(lang!age intero1era%ilit
Common Lang!age S1ecification "escri%es intero1era%ilitreG!irements
Lang!age
-
7/26/2019 Lecture on VB.net With Oracle Database
14/71
CL; E=ec!tion Mo"el
VBSource
codeCompiler
C++C#
CompilerCompiler
Assembly
IL Code
Assembly
IL Code
Assembly
IL Code
Operating System Services
Common Language Runtime
JI Compiler
!ative Code
"anaged
code
nmanagedComponent
-
7/26/2019 Lecture on VB.net With Oracle Database
15/71
.NET $rame9or8 Li%raries
Single consistentset of o%2ect oriente" class li%raries toena%le %!il"ing "istri%!te" 9e% a11lications Unifie"Classes/
B!ilt !sing classes arrange" across logical hierarchicalnames1aces
$or e=am1le Sstem.0ata.S@L
5or8 9ith all CL; lang!ages
No more VB;!n or M$C "i#i"e
-
7/26/2019 Lecture on VB.net With Oracle Database
16/71
.NET $rame9or8 Li%raries
#ni$ied Classes%eb Classes &AS'(!)*
+"L Classes
System Classes
,ra-ing Classes
%indo-s .orms,ata &A,O(!)*
Controls' Caching' (ecurity' (ession' Configuration etc
Collections' )iagnostics' *lobali+ation' ,' (ecurity'
%hreading (eriali+ation' Reflection' Messaging etc
-),' (.L'%ypes etc
)rawing' maging' %e&t' etc
)esign' Cmpnt Model etc
/(L%' "ath' (eriali+ation etc
-
7/26/2019 Lecture on VB.net With Oracle Database
17/71
-
7/26/2019 Lecture on VB.net With Oracle Database
18/71
Vis!al St!"io.NET
Integrate" 0e#elo1mentEn#ironment Vis!al Basic.NET
Inheritance* O#erloa"ing* $ree Threa"ing
Vis!al CFF
Integration 9ith .NET $rame9or8 9ith manage" e=tensionsclasses/
CNe9 "e#elo1ment lang!age
Base" on C
-
7/26/2019 Lecture on VB.net With Oracle Database
19/71
VS.NET $eat!res
Single I0E for allLang!ages
Ser#er E=1lorer E#ent Vie9er* Message @!e!es*
Ser#ices
S@L 0ata%ases* 0ata
Connection* Etc.
Integrate" IE Bro9ser
6TML
-
7/26/2019 Lecture on VB.net With Oracle Database
20/71
Vis!al Basic.NET
-
7/26/2019 Lecture on VB.net With Oracle Database
21/71
5hat is Vis!al Basic>
Visual BasicVB/ is a 1rogramming en#ironment from Microsoft
9hich a 1rogrammer !ses a gra1hical !ser interface ?UI/ to chan" mo"if 1reselecte" sections of co"e 9ritten in the BASIC
1rogramming lang!age
Vis!al refers to the metho" !se" to create 9hat the !ser seesKthe gra
user interface* or ?UI.
Basic refers to the BASIC Beginners All(P!r1ose Sm%olic Instr!ction C
1rogramming lang!age. The co"e loo8s a lot li8e English Lang!age. o!create !sef!l 1rograms % learning 2!st a fe9 of its feat!res.
-
7/26/2019 Lecture on VB.net With Oracle Database
22/71
Starting Vis!al St!"io &+,&
On the 5in"o9s Start screen* clic8 Visual Studio 2012.
o! ma also !se the search 9in"o9s to locate Vis!al St!"io &+,&.
If o! are 1rom1te" to i"entif o!r 1rogramming 1references*
select Vis!al Basic 0e#elo1ment Settings
After starting Vis!al St!"io* o!re rea" to e=1lore the
Vis!al St!"io I0E.
-
7/26/2019 Lecture on VB.net With Oracle Database
23/71
Integrate" 0e#elo1ment En#ironment
To start a new Visual Basic 2012project, simply click on New
Project.. to launch the Visual BasicNew Project page.
-
7/26/2019 Lecture on VB.net With Oracle Database
24/71
Creating New Project in Visual Basic 2012
In the Visual Basic New
Project page elect !in"ows #orm
$pplication
%hange the "e&ault Name'!in"ows$pplication1( to
the "esire" Project Name %lick )k *utton to
procee" to the ProjectPage.
-
7/26/2019 Lecture on VB.net With Oracle Database
25/71
Visual Basic 2012 Project Page
Pro2ect Page com1rises
a fe9 9in"o9s*
the Form window*
the Solution Exlorer
window* an"
the Proerties
window
the tool!ox9hichcontains man !sef!l
controls that allo9s a1rogrammer
to "e#elo1 his or herVB 1rograms.
-
7/26/2019 Lecture on VB.net With Oracle Database
26/71
S9itch Themes in Vis!al St!"io O1en the O1tions "ialog Tools ( O1tions/. Un"er En#ironment ( ?eneral*
setting is Color theme. o! can !se this to s9itch %et9een Light an" 0ar8.
-
7/26/2019 Lecture on VB.net With Oracle Database
27/71
Sa#ing Pro2ect Clic8 File "enu then Clic8 Sa#e All or 1ress Crtl$
S%i&t$S.
Sa#e Pro2ect 0ialog Bo= a11ears. Pro#i"e a 1ro2ect Name* location of the Pro2ect an" the
Sol!tion Name.
Ma8e s!re Create "irector for sol!tion is chec8e".
-
7/26/2019 Lecture on VB.net With Oracle Database
28/71
Acti#it ,
-
7/26/2019 Lecture on VB.net With Oracle Database
29/71
Acti#it , Creating an" Sa#ing VB Pro2ect
Ste1 ,. O1en Vis!al St!"io &+,&
Ste1 &. Sa#e o!r 1ro2ects !sing St!"ent ;ecor" as the $ilenam Ste1 4. Close o!r St!"ent ;ecor" Pro2ect
-
7/26/2019 Lecture on VB.net With Oracle Database
30/71
Lesson &. B!il"ing Interfaces
C!stomi3ing $orms
0esigner 5in"o9 Co"e 5in"o9
0EMO
M0I $orm* $orms
-
7/26/2019 Lecture on VB.net With Oracle Database
31/71
O%2ect Naming Con#entionControl t'e re&ix Examle
0ata%ase "% "%Acco!nts
Chec8 %o= ch8 ch8;ea"Onl
Com%o %o=* "ro1("o9n list %o= c%o c%oEnglish
Comman" %!tton cm" cm"E=it
Common "ialog "lg "lg$ileO1en
0ate 1ic8er "t1 "t1P!%lishe"
$orm frm frmEntr
$rame fra fraLang!age
Image img imgIcon
La%el l%l l%l6el1Message
-
7/26/2019 Lecture on VB.net With Oracle Database
32/71
O%2ect Naming Con#ention cont../Control t'e re&ix Examle
List %o= lst lstPolicCo"es
ListVie9 l#9 l#96ea"ings
Men! mn! mn!$ileO1en
O1tion %!tton o1t o1t?en"er
Pict!re %o= 1ic 1icV?A
ProgressBar 1rg 1rgLoa"$ile
Stat!sBar sta sta0ateTime
User !sr !srNe9
Te=t %o= t=t t=tLastName
Timer tmr tmrAlarm
-
7/26/2019 Lecture on VB.net With Oracle Database
33/71
Acti#it &
-
7/26/2019 Lecture on VB.net With Oracle Database
34/71
Acti#it & Create an M0I $orm
Name ( frmMain
5in"o9 State ( Ma=imi3e"
Te=t St!"ent Information
A"" a Men! Bar
Name mn!Main
$ile
E=it mn!E=it/
Enroll St!"ents mn!Eroll/
A"" a Stat!s
Name ( staMain
0ate ( sta0ate
-
7/26/2019 Lecture on VB.net With Oracle Database
35/71
-
7/26/2019 Lecture on VB.net With Oracle Database
36/71
A""ing Controls to the $orm
5al8thro!gh in a""ing an" c!stomi3ing
La%el
Te=tBo=
Com%oBo=
B!ttonsListVie9
?ro!1Bo=
-
7/26/2019 Lecture on VB.net With Oracle Database
37/71
ACTIVIT 4
-
7/26/2019 Lecture on VB.net With Oracle Database
38/71
-
7/26/2019 Lecture on VB.net With Oracle Database
39/71
Lesson 4. 5riting the Co"e
Un"erstan"ing $!nctions
$!nctions are name" %loc8s of 1rogram co"e that 1erform atas8 an" ret!rn a res!lt.
P!%lic $!nction S!mB;ef N!m%er, As 0o!%le* B;ef N!m%er& As 0o!%le/ As 0
;et!rn the res!lt % 9riting it to a #aria%le ha#ing the same name as the f!
S!m Q N!m%er, F N!m%er&En" $!nction
-
7/26/2019 Lecture on VB.net With Oracle Database
40/71
Proce"!res or S!%ro!tine
A s!%ro!tine is li8e a f!nction* 2!st that it "oes not
ret!rn a res!lt.
P!%lic S!% TellBVal MString, as String* BVal MString& as String/
MsgBo= MString, R MString&
En" S!%
-
7/26/2019 Lecture on VB.net With Oracle Database
41/71
6an"ling Errors
Onl 1erfect 1rogrammers create 1erfect
co"e from the %eginning.The rest m!st a""ress im1erfections along
the 9a to "e#elo1ing a s!ccessf!l
a11lication.
0 fi i i f E " E i
-
7/26/2019 Lecture on VB.net With Oracle Database
42/71
0efinitions of Errors an" E=ce1tions
The terms* error an" e=ce1tion* are often !se"
interchangea%l
In fact* an error* 9hich is an e#ent that ha11ens "!ringthe e=ec!tion of co"e* interr!1ts or "isr!1ts the co"es
normal flo9 an" creates an e=ce1tion o%2ect
5hen an error interr!1ts the flo9* the 1rogram tries to
fin" an e=ce1tion han"ler K a %loc8 of co"e that tells it
ho9 to react K that 9ill hel1 it res!me the flo9
In other 9or"s* an error is the e#ent an e=ce1tion is the
o%2ect that the e#ent creates.
-
7/26/2019 Lecture on VB.net With Oracle Database
43/71
Str!ct!re" #ers!s Unstr!ct!re" Str!ct!re" e=ce1tion han"ling is sim1l that K
!sing a control str!ct!re containing e=ce1tions*
isolate" %loc8s of co"e* an" filters to create an
e=ce1tion han"ling mechanism. This allo9s o!r
co"e to "ifferentiate %et9een "ifferent t1es of
errors an" react in accor"ance 9ith
circ!mstances.
In !nstr!ct!re" e=ce1tion han"ling* an (n Error
statement at the %eginning of the co"e han"les
all e=ce1tions.
-
7/26/2019 Lecture on VB.net With Oracle Database
44/71
Str!ct!re" #ers!s Unstr!ct!re" contD/
Str!ct!re" e=ce1tion han"ling is significantl
more #ersatile* ro%!st* an" fle=i%le than
!nstr!ct!re".
If 1ossi%le* !se str!ct!re" e=ce1tion han"ling.
6o9e#er* o! might !se !nstr!ct!re" e=ce1tion
han"ling !n"er some circ!mstances
Th T C t h $i ll %l 8
-
7/26/2019 Lecture on VB.net With Oracle Database
45/71
The Tr...Catch...$inall %loc8
The )r'statement 1ro#i"es the co"e that is %eing teste"
for e=ce1tions.
Catc%cla!ses i"entif %loc8s of co"e that are associate"9ith s1ecific e=ce1tions.
The Finall'statement contains co"e that e=ec!tes
regar"less of 9hether or not an e=ce1tion occ!rs 9ithin
the Tr %loc8. A $inall statement 9ill e=ec!te e#en after
an E=it Tr or E=it S!%. This co"e often 1erforms clean(!1tas8s* s!ch as closing files or clearing %!ffers.
-
7/26/2019 Lecture on VB.net With Oracle Database
46/71
Str!ct!re" E=ce1tion 6an"ling)r'
#arA#aila%leSeats Q #arA!"itori!mSeats ( #arN!m%erOf?!ests
Catch e= As E=ce1tion 5hen #arA!"itori!mSeats Q + MsgBo=A!"itori!m lac8s chairs/
E=it S!%
Catc% ex As E=ce1tion 5hen #arA#aila%leSeats +
MsgBo=There are no more a#aila%le seats./
E=it S!%
Finall'
MsgBo=Than8 o! for o!r interest in o!r concert./
End )r'
U t t " E ti 6 "li
-
7/26/2019 Lecture on VB.net With Oracle Database
47/71
Unstr!ct!re" E=ce1tion 6an"ling
Unstr!ct!re" e=ce1tion han"ling is im1lemente" !sing the Erro%2ect
an" three statements (n Error* *esume* an" Error.
The (n Errorstatement esta%lishes a single e=ce1tion han"ler that catchesall thro9n e=ce1tions
*esume and *esume Next
The *esume statement % itself can ret!rn control to the statement that ca!se"
the e=ce1tion.
*esume Nextcan %e !se" to allo9 gracef!l fail!res
)%e Error (!ject
The #al!es of the 1ro1erties of the Erro%2ect are "etermine" % the error that 2!st
occ!rre"
Sam1le of Unstr!ct!re" E=ce1tion 6an"ling
-
7/26/2019 Lecture on VB.net With Oracle Database
48/71
Sam1le of Unstr!ct!re" E=ce1tion 6an"ling
(n Error ,o)o
Pri#ate S!% $la9lessCo"e/
(n Error ,o)o -%oos Co"e "oing #ario!s things
0ont 8ee1 going into the error han"ling co"e.
;et!rn
-%oos.
Pro#i"e !ser 9ith error information.
MsgBo= Une=1ecte" Error R Err/escrition/
;et!rn
En" S!%
S l f U t t " E ti 6 "li g t /
-
7/26/2019 Lecture on VB.net With Oracle Database
49/71
Sam1le of Unstr!ct!re" E=ce1tion 6an"ling contD/On Error ;es!me Ne=t
0im ErrorMessage As String
Constr!ct an error message if an error occ!rs.
On Error ;es!me Ne=t
Err.;aise ,4/ ?enerate t1e mismatch error.
Chec8 to see if an error has occ!rre". If so* sho9 message.
If Err.N!m%er + Then
ErrorMessage Q Error R StrErr.N!m%er/ R 9as generate" %
R Err.So!rce R #%CrLf R Err.0escri1tion 0is1la the message as a critical message.
MsgBo=ErrorMessage* MsgBo=Stle.Critical* Error/
En" If
-
7/26/2019 Lecture on VB.net With Oracle Database
50/71
Acti#it 4
-
7/26/2019 Lecture on VB.net With Oracle Database
51/71
-
7/26/2019 Lecture on VB.net With Oracle Database
52/71
PA;T II
Lesson 7 5or8ing 9ith Oracle 0ata%ase
-
7/26/2019 Lecture on VB.net With Oracle Database
53/71
Lesson 7. 5or8ing 9ith Oracle 0ata%ase
Creating ser Accounts and "anaging Pri#ileges
-alt%roug% in creating user account using (racleata!ase Exress 3ome Page/
Oracle 0ata Pro#i"er for Net
-
7/26/2019 Lecture on VB.net With Oracle Database
54/71
Oracle 0ata Pro#i"er for .Net
Oracle 0ata Pro#i"er for .NET O0P.NET/ feat!res
o1timi3e" A0O.NET "ata access to the Oracle "ata%aseO0P.NET allo9s "e#elo1ers to ta8e a"#antage of a"#ance"
Oracle "ata%ase f!nctionalit* incl!"ing ;eal A11lication
Cl!sters* HML 0B* an" self(!1"ating client caches.
O0P.NET ma8es !sing Oracle from .NET more fle=i%le* faster
an" more sta%le. O0P.NET incl!"es man feat!res not fo!n" other .NET "ri#ers* incl!"ing fle=i%le LOB "ata t1es* self(
t!ning* r!n(time connection loa" %alancing* fast connection
failo#er* an" A"#ance" @!e!ing.
-
7/26/2019 Lecture on VB.net With Oracle Database
55/71
Acti#it 7
-
7/26/2019 Lecture on VB.net With Oracle Database
56/71
-
7/26/2019 Lecture on VB.net With Oracle Database
57/71
Lesson :
-
7/26/2019 Lecture on VB.net With Oracle Database
58/71
Lesson :
Creating Connection to Oracle 0ata%asea""ing 1ro2ect references to s!11ort Oracle
class li%raries in o!r .NET 1ro2ectCreating Oracle 0ata%ase connection strings5or8ing 9ith Connection* Comman"* an"
0ata;ea"er
-
7/26/2019 Lecture on VB.net With Oracle Database
59/71
5hen "e#elo1ers !se %o!n" controls the en" !1 1!tting a lot of
%!siness logic into the clic8 e#ents* change e#ents an" so on* so 9hen
r!les change it is "iffic!lt to ferret o!t all the 1laces in the co"e that
nee" to %e to!che". As long as the a11lication is co"e" to ta8e these
things into consi"eration then %o!n" controls are 2!st another tool in
the tool%o=.
I g!ess the iss!e is that it is often the "e#elo1ers 9ho ha#ent et
learne" to 1a attention to these things 9ho are the ones that %o!n"
controls are most attracti#e to* so the co"e 1ro"!ce" en"s !1 %eing
less than i"eal.
Bound #s n!ound controls $ -%ic% s%ould I use4
-
7/26/2019 Lecture on VB.net With Oracle Database
60/71
Bound #s n!ound controls -%ic% s%ould I use4
T1icall* 9hen "e#elo1ers !se %o!n" controls the en" !1 1!tting a
lot of %!siness logic into the clic8 e#ents* change e#ents an" so on* so9hen r!les change it is "iffic!lt to ferret o!t all the 1laces in the
co"e that nee" to %e to!che". As long as the a11lication is co"e" to
ta8e these things into consi"eration then %o!n" controls are 2!st
another tool in the tool%o=.
I g!ess the iss!e is that it is often the "e#elo1ers 9ho ha#ent et
learne" to 1a attention to these things 9ho are the ones that %o!n"
controls are most attracti#e to* so the co"e 1ro"!ce" en"s !1 %eing
less than i"eal.
Sho!l" o! !se A0O NET 0ata;ea"er or 0ata
-
7/26/2019 Lecture on VB.net With Oracle Database
61/71
Sho!l" o! !se A0O.NET 0ata;ea"er or 0ata
In the %eginning* there 9as the recor"set* a central
feat!re of classic A(. Li8e a S9iss arm 8nife* it 9asnt the
1erfect tool for e#er 2o%* %!t gi#en the correctconfig!ration* it co!l" "o 9hate#er o! nee"e" it to "o.
6o9e#er* A(/NE)9as a totall ne9 set of com1onents*
an" it 9as o1timi3e" for the Internet 9orl".
5hen accessing "ata 9ith A0O.NET* o! can !se either a
0ata;ea"er or a 0ataSet
Access t%roug% ata*eader
-
7/26/2019 Lecture on VB.net With Oracle Database
62/71
Access t%roug% ata*eader
So* 9hat is a 0ata;ea"er> It is a one(9a* for9ar"(onl
metho" of rea"ing "ata. A common !se of the 0ata;ea"er
to rea" thro!gh a res!lt set.
5hen o! get the res!lts into the 0ata;ea"er* its
im1ortant to note that the c!rsor or logical 1ointer into
the ret!rne" "ata is 2!st %efore the first ro9. o! nee" to
call .;ea"/ once to rea" an "ata. .;ea"/ 9ill ret!rn tr!e
as long as there is an a""itional ro9 to %e rea".
Access t%roug% ataSet
-
7/26/2019 Lecture on VB.net With Oracle Database
63/71
Access t%roug% ataSet
A 0ataSet is a "ata%ase(in"e1en"ent* in(memor "ata
store that ena%les the "e#elo1er to "irectl access all
ro9s an" col!mns of one or man ta%les that a 0ataSetcan contain.
The 0ataSet has a Ta%les collection of 0ataTa%le o%2ects*
an" the 0ataTa%le has a ;o9s collection that can %e
in"e=e" to get to a 1artic!lar ro9 % n!m%er. The ;o9s
collection has a .Co!nt 1ro1ert that ena%les the
"e#elo1er to "etermine the n!m%er of ro9s in an of theta%les in a 0ataSet.
Access t%roug% ataSet
-
7/26/2019 Lecture on VB.net With Oracle Database
64/71
Access t%roug% ataSet
The 0ataSet ena%les o! to !1"ate the in(memor co1 of
the "ata* an" !se a 0ataA"a1ter s1ecific to a "ata
1ro#i"er to ha#e those changes 1ersiste" %ac8 in the"ata%ase.
The im1ortant thing to remem%er is that the 0ataSet is
in"e1en"ent of an 1artic!lar "ata%ase the onl
connection that e=ists is 9hen the 0ataSet is !se" in
con2!nction 9ith a 0ataA"a1ter.
-%ic% to use4
-
7/26/2019 Lecture on VB.net With Oracle Database
65/71
If o! nee" rea"(onl access to the "ata* something often
"one insi"e an ASP.NET a11lication* !sing a 0ata;ea"er
ma8es sense. Unless o! are going to 1ersist the "ata
%et9een 1ost%ac8s* the "ata that o! !se to* sa*1o1!late a gri"* 9ill not %e 1resent 9hen someone clic8s
on one of the ro9s of that gri".
5hen !1"ates to the "ata are reG!ire"* o! can either
"irectl e=ec!te UP0ATE* INSE;T or 0ELETE S@L
statements* or o! can call a store" 1roce"!re. 5hile this
seems li8e more 9or8 that 2!st !1"ating "ata in a
0ataSet* it gi#es o! more control o#er e=actl ho9 the
!1"ates ta8e 1lace* an" 9or8s #er 9ell in a 9e%
en#ironment.
-%ic% to use4
-
7/26/2019 Lecture on VB.net With Oracle Database
66/71
One 1ossi%le "isa"#antage of !sing a 0ata;ea"er is that
the connection m!st %e o1en 9hile o! are accessing the
"ata. If o! 9ill %e "oing length 1rocessing 9ith each ro9
of ret!rne" "ata* a 0ataSet might %e a %etter i"ea.
If o! are %!il"ing a 5in"o9s $orms a11lication or a
Smart Client/* 0ataSets offer some a"#antages. Since the
a11lication 9ill maintain its state o#er the entire time it is
r!nning* an" client conte=t "oes not tie !1 ser#er
reso!rces* !sing a 0ataSet can %e #er con#enient for5in"o9s $orms a11lications.
-%ic% to use4
-
7/26/2019 Lecture on VB.net With Oracle Database
67/71
The "ar8 si"e of !sing 0ataSets is that the "ata remains in
memor for as long as o! !se it. If o! are retrie#ing
tho!san"s or millions of ro9s* a 0ataSet is 1ro%a%l not ani"eal sol!tion
-
7/26/2019 Lecture on VB.net With Oracle Database
68/71
Acti#it :
-
7/26/2019 Lecture on VB.net With Oracle Database
69/71
-
7/26/2019 Lecture on VB.net With Oracle Database
70/71
3ANS (N E5E*CISES
-
7/26/2019 Lecture on VB.net With Oracle Database
71/71
)%an 6ou 777