Professional Documents
Culture Documents
*. Jhis class us used to ead data Brom the &L seAver datalase
Heady data Cn the forwand direction le) once it eads a
1. Connection:
the Sql lonnection asociated with the SolDataReader
&t qets
2.Depth: fby the w.
dt qett a ualue that ndicatek the depth oy
3. Isosed :
Hetsievek Js9olean value Jthat Endícates wthetne the
MOthods:
Systen;
wsing ystem- Data. slclient;
namespace AdoNet (onsce Applicai on
UTLC1a
cass Progham
static Vgd Main
connection. Open O;
Sa,1Data Reader sdr = cmd. Exeute ReaderC);
while (sdr. Read C))
catch ( ExCeptten e)
yhen to wse?
datasece.
Constuctors :
a) SqlData Adapter )
b) SlData Adaple (sllommand selectiommand)
) SyiData Adaptes (sting select CommandText , stng select ConrectionSirm)
) a1Data Adapteu (sting select Command Text , alConnection select Connectton)
MethodK:
a) Dispose (Boolean)
t is used to discard the maraqed esancek .
5) FUl ( Dataset):
dt wsed te add eUy ñn the DOtaset t match tho ce in
Student Table:
clas Progam
static
vaid Main (stringti gs)
3
J coutcn ( EKCeption e)
utng aystem ;
Uscng system. Data;
ucng system Data. SqlClient ;
class PAo gham
Static
sthing cone ction Stuing data seusce =ITUll -19 \SQL Express ; dalabak =
Student DB, integrated secusity - sSPT 1
static veid
Main (StLingi angs)
Using (&ay lConne ctten connectian : new sy (onnection (onne ctio n&aing))
connection . Openc);
breatestudentsTalle cuonnection);
Inset Stude nt(connecticn,"Inisha, 2u 5DD6Qnec. edu-in ", IT)i
Console- walteLine ("List cf Students : ");
Dlsplay AIIStudents (onne ctis n);
3
catch ( Exceptron e)
Console. WitelineC"EnoY+ e.
{
Command. tyele
NonQueug))
3
staic vsld InseuStudent CSllonnectio n connetion, Stuing name, sUing
email , 8tuing depament)
: "INSE RT INTO Students (Name, Emall , Depantment)
stng VALUES(@Name, @ mail, @Depatment)";