0% found this document useful (0 votes)
2 views

Na Sp Edited

The document outlines a series of programming assignments related to web technology, including money conversion, hotel webpage design, and user feedback systems. Each program includes design specifications, properties of controls, and sample code for implementation. The assignments are structured into two parts, with part A focusing on various web applications and part B on database management applications.

Uploaded by

vyntraq
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Na Sp Edited

The document outlines a series of programming assignments related to web technology, including money conversion, hotel webpage design, and user feedback systems. Each program includes design specifications, properties of controls, and sample code for implementation. The assignments are structured into two parts, with part A focusing on various web applications and part B on database management applications.

Uploaded by

vyntraq
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 39

NAME:

NIHALREGNO.
3SU21SA100 LABONWEBTECHNOLOGY

I
NDEX

NO PROGRAM NAME PAGENO

PARTA
1 Wr
it
eapr
ogr
am t
oper
for
m moneyconv
ersi
on 3-
4
2 Desi
gnaWebpageofaHot
elwhi
chdi
spl
aydi
ff
erentMenuasper 5-
7
theTi
meofVi
sit
.
3 “Howi sthebookASP. NETwithc#byVi pulPrakashan?” Givet
he 8-
9
usert hr
e echoice:
i
)Good
i
i)Sat i
sfact
ory
i
ii
)Bad.
ProvideaVOTEbut t
on.Aft
eruservotes,presentt
her esul
tin
percentageusinglabel
snexttothechoices.
4 Createawebappl
icat
iontoper
formfat
,car
bohydr
ates,Total
noof 10-
11
calori
es.
5 WriteaProgr
am t
ocreateanAdver
ti
sementusi
ngAdr otat
or. 12-
13
6 Desi
gnaAdmi
ssi
onf
orm wi
thcl
i
entsi
dev
ali
dat
ions 14-
15
7 Creat
eawebappli
cat
iont
odemonst
rat
eCool
dri
nksandf
ind 16-
17
tot
alcostpr
ogr
am.
8 Creat
eawebappl
i
cat
iont
oil
l
ust
rat
eCheckboxLi
standRadi
oBut
ton 18-
19
Contr
ol.
PARTB
1 Cr
eat
eawebappl
i
cat
iont
oper
for
m Si
mpl
eLogi
nusi
ngdat
abase. 21-
22
2 Createawebappli
cati
ont
ocheckt
heavai
labi
l
ityofuser
namefrom 23-
24
database.
3 Createawebappli
cati
ont
omanagecust
omerinformati
onusi
ng 25-
27
ADO. NETdat
abase.
4 Cr
eateawebappli
cat
iont
omanageempl
oyeer
ecor
dand 28-
32
Fi
l
ter
ingbydepar
tment
5 Creat
eawebappl
icat
iontoperf
orm st
udenti
nfor
mat
ionsy
stem 33-
39
(Fi
ndtot
almar
ks,
grade,aver
age).

1
NAME:
NIHALREGNO.
3SU21SA100 LABONWEBTECHNOLOGY

PARTA

2
NAME:
NIHALREGNO.
3SU21SA100 LABONWEBTECHNOLOGY

PROGRAM NO.01

Wr
it
eapr
ogr
am t
oper
for
m moneyconv
ersi
on

DESI
GN:

PROPRTI
ES:

CONTROLS PROPERTI
ES VALUE
Label
1 Text Enterthevalue
Label
2 Text SelectCurr
encyty
pe
Label
3 Text SelectCurr
ency
ForConv er
sion
Labe4 Text Label
I
D l
blms
g
TextBox I
D txt
amt
Dropdownl
i
st1I
D ddtype1
Dropdownl
i
st2I
D ddtype2
Butt
on Text Conv er
I
D tBtnclk

CODE:
pr
otectedvoidbtnclk_Cl
ick(
obj ectsender,Event
Argse)
{
doubleamt ;
amt =Convert.
ToDoubl e(
txtamt .Te
xt);
i
f(ddlt
ype1.SelectedI
tem.Val ue==" dol
lar
"&&
ddlty
pe2.SelectedIt
em.Value==" rupee"
)
lbl
msg. Text=" Rs"+Conv ert.ToStri
ng(
amt*70) ;

el
seif(ddlt
ype1.SelectedIt
em. Val
ue=="rupee"&&
ddl
type2.Sel
ectedIt
em. Value==" dol
lar
")
lbl
msg. Text="$"+Conv ert
.ToStr
ing(
amt/70) ;

el
seif(ddl
type1.Select
edI
tem.Val
ue==" eur
o"&&
ddlt
ype2.
SelectedIt
em.Val
ue==" rupee"
)
lbl
msg.Text=" Rs"+Convert
.ToStri
ng(
amt*120);

el
sei
f(ddl
type1.
Sel
ect
edI
tem.
Val
ue=="
rupee"&&

3
NAME:NI
HALREGNO. 3SU21SA100 LABONWEBTECHNOLOGY
ddlt
ype2.
Sel
ectedI
tem.Val
ue=="euro"
)
l
blmsg.
Text="euro"+Conver
t.
ToStr
ing(
amt/120);

el
sei
f(ddl
type1.
Sel
ect
edI
tem.
Val
ue=="
dol
l
ar"&&

ddl
type2.
Sel
ect
edI
tem.
Val
ue=="
eur
o")

l
blmsg.
Text="
eur
o"+Conv
ert
.ToSt
ri
ng(
amt*25)
;

elseif(
ddltype1.Select
edItem.Val
ue==" eur
o"&&
ddlty
pe2.SelectedIt
em. Value=="doll
ar")
lbl
msg. Text=" $"+Conv ert.
ToStr
ing(amt/
25);el
se
lbl
msg. Text=Conv er
t.ToStr
ing(
amt )
;

}
}
}

OUTPUT

4
NAME:
NIHALREGNO.
3SU21SA100 LABONWEBTECHNOLOGY

PROGRAM NO.2

Desi
gnaWebpageofaHot
elwhi
chdi
spl
aydi
ff
erentMenuaspert
heTi
meofVi
sit
.

DESI
GN:

PROPRETI
ES:

CONTROLS PROPERTI
ES VALUE
Label
1 I
D l
bli
tem1
Label
2 I
D l
blpri
ce1
Label
3 I
D l
bli
tem2
Label
4 I
D l
blpri
ce2
Label
5 I
D l
bli
tem3
Label
6 I
D l
blpri
ce3
Label
7 I
D l
bli
tem4
Label
8 I
D l
blpri
ce4
Label
9 I
D
Label
10 I
D

CODE:

pr
otectedv oi
dPage_Load( objectsender
,Event
Argse)
{
lblt
ime.Text=DateTime. Now.ToStri
ng()
;
if(DateTime.Now.
Hour>=6&&Dat eTi
me.Now.Hour<12)
{
lbl
it
em1. Text="
khali dosa";
lbl
price1.
Text="Rs.20" ;
lbl
it
em2. Text="
pulav ";
lbl
price2.
Text="Rs.30" ;
lbl
it
em3. Text="
idl
iv ada";
lbl
price3.
Text="Rs.50" ;
lbl
it
em4. Text="
porot ta";
lbl
price4.
Text="Rs.25" ;
}
elseif(DateTime.
Now. Hour>=12&&Dat eTime.Now.
Hour<15)
{

5
NAME:
NIHALREGNO.
3SU21SA100 LABONWEBTECHNOLOGY

lbl
it
em1. Text=" meal ";
lbl
price1.Text=" Rs.200" ;
lbl
it
em2. Text=" v egbi riyani
";
lbl
price2.Text=" Rs.150" ;
lbl
it
em3. Text=" friedr ice";
lbl
price3.Text=" Rs.100" ;
lbl
it
em4. Text=" rot i
";
lbl
price4.Text=" Rs.25" ;
}
el
seif(Dat eTi me.Now. Hour>=15&&Dat eTi
me.Now.Hour<19)
{
lbl
it
em1. Text=" samoosa" ;
lbl
price1.Text=" Rs.20" ;
lbl
it
em2. Text=" podi ";
lbl
price2.Text=" Rs.25" ;
lbl
it
em3. Text=" masal a
dosa" ;l
blprice3.Text=
"Rs.45";lbli
tem4. Text=
"buns";lblprice4.Text=
"Rs.25";
}
el
se
{
lbl
close.Text=" Hot el closed";
lbl
close.For eColor=
System. Drawi ng.Col or.Red;
lbl
close.At tri
butes.Add( "st
yle"
,"f
ont
-si
ze:
25px;
font
-weight
:bol
d;"
);
lbl
it
em1. Visible=f alse;
lbl
price1.Visible =
fal
se; l blitem2.Vi si
bl e
= false;
lbl
price2.Visible =
fal
se; l blitem3.Vi si
bl e
= false;
lbl
price3.Visible =
fal
se; l blitem4.Vi si
bl e
= false;
lbl
price4.Visible =
fal
se;
}
}
}
}

6
NAME:
NIHALREGNO.
3SU21SA100 LABONWEBTECHNOLOGY

OUTPUT

7
NAME:
NIHALREGNO.
3SU21SA100 LABONWEBTECHNOLOGY

PROGRAM NO.3

“Howi sthebookASP.
NETwi t
hc#byVipulPrakashan?” Gi
vetheuserthr
eechoice:
i
)Good
i
i)Sati
sfact
ory
i
ii
)Bad.
Provi
deaVOTEbut t
on.Af
teruserv
otes,
presenttheresul
tinpercent
ageusingl
abels
nexttothechoi
ces.
DESIGN

PROPERTI
ES:

CONTROLS PROPERTI
ES VALUE
Label
1 Text Howi stheC#book?
Label
2 I
D Label2
Label
3 I
D Label3
Label
4 I
D Label4
Label
5 Text TotalWor k
Label
6 Text Result
I
D tot
alwor
k
Radi
oBut
ton1 Text Good
I
D RadioButton
1
Radi
oBut
ton2 Text Sati
sfactory
I
D RadioButton2
Radi
oBut
ton3 Text Bad
I
D RadioButton
3
But
ton Text Vote

CODE:

st
ati
cintgcount,scount,
bcount;
pr
otect
edv oi
dBut ton1_
Click(
obj
ectsender
,Ev
ent
Argse)
{
if
(Radi
oButton1.Checked)
8
NAME: NIHALREGNO. 3SU21SA100 LABONWEBTECHNOLOGY
{
i
f( ViewSt ate["
gcount "]!=null)
gcount=Conv ert.ToInt32(ViewSt at
e["gcount
"])+1;
el
se
gcount=1;
ViewSt ate["gcount"]=gcount ;
}
i
f(Radi oButton2.Checked)
{
i
f( ViewSt ate["
scount "]!=null)
scount=Conv ert.
ToI nt32(ViewSt at
e["
scount"])+
1;else
scount=1;
ViewSt ate["scount"]=scount ;
}
i
f( RadioBut ton2.Checked)
{
i
f( ViewSt ate["
bcount "]!=null)
bcount=Conv ert.ToInt32(ViewSt at
e["bcount
"])+1;
else
bcount=1;
ViewSt ate["bcount"]=bcount ;
}
i
ntt otalcount=gcount+scount+bcount ;
doubl egper=( Conv ert.ToDoubl e(gcount)
)/Conv ert
.ToDouble(
tot
alcount)
*100.0f;
doubl esper=( Conv ert.ToDoubl e(scount)
)/Conv ert
.ToDouble(
tot
alcount)*
100. 0f;doublebper=( Conv ert
.ToDoubl e(
bcount))/Convert
.ToDouble(t
otal
count
)
*
100.0f
;
Label 2.Text=gper .ToSt ri
ng( )+" %";
Label 3.Text=sper .ToSt ri
ng( )+"%" ;
Label 4.Text=bper .ToSt ri
ng( )+"%” ;
}
}
}

OUTPUT

9
NAME:
NIHALREGNO.
3SU21SA100 LABONWEBTECHNOLOGY

PROGRAM NO.4

Cr
eat
eawebappl
icat
iont
oper
for
mfat
,car
bohy
drat
es,
Tot
alnoofcal
ori
es.

DESI
GN:

PROPERTI
ES:

CONTROLS PROPERTI
ES VALUE
Label
1 Text Totalcalori
esfrom fatand
carbohydrate
Label
2 Text AmountofFAT( ingr
ams)
Label
3 Text Amountof
carbohydrates(
ingrams)
Label4 Text Label
TextBox1 I
D TextBox1
TextBox2 I
D TextBox2
Butt
on Text Calcul
at
I
D e
tot
alcal

CODE:

pr
otectedv oidtot alcal_Cli
ck(obj
ectsender,Event
Argse)
{
intcfat,ccarbo, totalcal;
intfat=I nt
32. Par se(TextBox1.
Text);
intcarbohy drate=
Int32.Parse(Text Box2. Text
);cf
at=f at*9;
ccarbo=car bohy dr ate*
4;totalcal=cf at+ccar bo;
Label4.Text=" Tot alCalori
es="+totalcal
.ToSt
ri
ng()+"
grams"
;
}
}
}

10
NAME:
NIHALREGNO.
3SU21SA100 LABONWEBTECHNOLOGY

OUTPUT

11
NAME:
NIHALREGNO.
3SU21SA100 LABONWEBTECHNOLOGY

PROGRAM NO.05

Wr
it
eaPr
ogr
am t
ocr
eat
eanAdv
ert
isementusi
ngAd

r
otat
or.DESI
GN:

CODE:

<?xml versi
on="1. 0"encoding="utf
-8"?
>
<Advertisement s>
<Ad>
<I
mageUr l
>pic1. j
pg</I
mageUr l>
<TargetUrl
>"D: \keer
thana\WebAppl i
cat
ion6\pic1.jpg"</Target
Url>
<Alt
ernateText >hereistheamazonr ainforest</AlternateText
>
<I
mpr essions>10</ Impressions>
</Ad>
<Ad>
<I
mageUr l
>pic2. j
pg</I
mageUr l>
<TargetUrl
>"D: \keer
thana\WebAppl i
cat
ion6\pic2.jpg"</Target
Url>
<Alt
ernateText >hereistheamazonr ainforestani mals</Alter
nateText>
<I
mpr essions>10</ Impressions>
</Ad>
<Ad>
<I
mageUr l
>pic3. j
pg</I
mageUr l>
<TargetUrl
>"D: \keer
thana\WebAppl i
cat
ion6\pic3.jpg"</Target
Url>
<Alt
ernateText >hereistheamazonr ainforestri
v ers</Alter
nateText>
<I
mpr essions>10</ Impressions>
</Ad>

</
Adv
ert
isement
s>

12
NAME:
NIHALREGNO.
3SU21SA100 LABONWEBTECHNOLOGY

OUTPUT:

13
NAME:
NIHALREGNO.
3SU21SA100 LABONWEBTECHNOLOGY

PROGRAM NO:
06

Desi
gnaAdmi
ssi
onf
orm wi
thcl
ientsi
de

v
ali
dat
ionsDESI
GN:

PROPERTI
ES:

CONTROLS PROPERTI
ES VALUE
Label
1 Text Regist
erat
ionfor
m
Label
2 Text Name
Label
3 Text RegNo
Label
4 Text Dateofbirt
h
Label
5 Text Department
Label
6 Text Address
Label
7 Text Phonenumber
Label
8 Text Homenumber
Label
9 Text Mail
Butt
on1 Text Submit
Butt
on2 Text Clean

CONTROLSTOVALI
DATI
ON:

VALIDATION ERRORMESSAGES TOCONTROL


CONTROLS
Requi
redfi
eld(l
abel1) Mustent
ername Text
Box1
Rangevali
dator
(label
2) Mustbet
ween1001t o2000 Text
Box2
Requi
redfi
eld(l
abel3) Mustent
erdateofbir
th Text
Box3
Requi
redfi
eld(l
abel4) Mustent
erdepartment Text
Box4
Requi
redfi
eld(l
abel5) Mustent
eraddress Text
Box5
Requi
redexpression(
label
6)Mustent
erphonenumber Text
Box6
Requi
redexpression(
label
6)Mustent
erphonenumber Text
Box7

Requi
redex
pressi
on(
label
6) Mustent
eremail
id Text
Box8
14
NAME:
NIHALREGNO.
3SU21SA100 LABONWEBTECHNOLOGY

OUTPUT:

15
NAME:
NIHALREGNO.
3SU21SA100 LABONWEBTECHNOLOGY

PROGRAM NO.7

Cr
eat
eawebappl
icat
iont
odemonst
rat
eCooldr
inksandf
indt
otalcost

pr
ogr
am.DESI
GN:

PROPERTI
ES:

CONTROLS PROPERTI
ES VALUE
Li
stBox I
tems Cola,
Maaza,
Lime,
Spr
it
e
Butt
on Text Fi
ndcost
Label Text Label

CODE:

pr
otectedv oidListBox1_Sel
ectedI
ndexChanged(
obj
ectsender
,Ev
ent
Argse)
{
Label1.Text="" ;
if(ListBox1. Select
edIt
em.Text==
"
Col a")Image1. I
mageUr l="Col
a.j
pg";
if(ListBox1. Select
edIt
em.Text==
"
Maaza" )I
mage1. I
mageUr l=
"
Maaza. jpg";
if(ListBox1. Select
edIt
em.Text==
"
Lime" )I mage1.ImageUrl=
"
Lime. jpg";
if(ListBox1. Select
edIt
em.Text==
"
Spr it
e")I mage1.ImageUrl=
"
spr i
te.jpg";
}

pr
otectedv oi
dBut t
on1_ Cli
ck(
objectsender,Event
Argse)
{
i
f(List
Box1.SelectedI
tem.Text==" Cola"
)
Label1.
Text=" Youselectedcolaandi t
scostis:
30.RS";
if(Li
stBox1.Select
edIt
em.Text==" Maaza")
Label1.
Text=" YouselectedMaaz aandi t
scostis:
35.RS";
if(Li
stBox1.Select
edIt
em. Text=="Lime"
)
16
NAME:NIHALREGNO. 3SU21SA100 LABONWEBTECHNOLOGY
Label
1.Text="Yousel ect
edLimeandi t
scostis:
20.RS";
if(Li
stBox1.Sel
ectedI
tem.Text=="Spr
it
e")
Label
1.Text="Yousel ect
edSprit
eanditscostis:
40.
RS"
;
}

OUTPUT:

17
NAME:
NIHALREGNO.
3SU21SA100 LABONWEBTECHNOLOGY

PROGRAM NO:
08

Cr
eat
eawebappl
icat
iont
oil
lust
rat
eCheckboxLi
standRadi
oBut
tonCont
rol

DESI
GN:

PROPERTI
ES:

CONTROLS PROPERTI
ES VALUES
Label
1 Text Name
Label
2 Text Regno
Label3 Text DOB
Label4 Text Gender
Label5 Text Hobbies
Label6 Text Label
TextBox1 I
D TextBox1
TextBox2 I
D TextBox2
RadioBut
ton1 I
D RadioBut
ton
Text 1Mal e
Radi
oBut
ton2 I
D RadioBut
ton2
Text Female
CheckBoxl
i
st
Butt
on Text Submi t
Cal
ender I
D Calender1

CODE:

pr
otect
edv oidButt
on1_ Cli
ck(objectsender
,Event
Argse)
{
Str
ingName=Text Box1.Text;
Str
ingRegNo=Text Box2.Text
;
DateTimeselectedDat e=
Calendar1.
SelectedDate;DateTimeDOB=
18
NAME:NI
HALREGNO.3SU21SA100 LABONWEBTECHNOLOGY
sel
ect
edDat
e;

StringGender ;
i
f( RadioBut t
on1. Checked)
{
Gender=" Male";
}
else
{
Gender=" Femal e"
;
}
StringHobbi es="" ;
i
nti ;
for( i=0; i<CheckBoxLi st1.
Items.Count;i
++)
{
if(CheckBoxLi st1.I
tems[i]
.Sel
ected)
{
Hobbi es=Hobbi es+CheckBoxLi st1.
Items[
i]
.Val
ue+",
";
}
}
Label 5.Text=" Name: "+Name+" <br
/"+" RegNo:"+RegNo+" <br
/"+"Gender
:"
+Gender+" <br/>"+" Hobbies:"+Hobbi es+" <br
/>"+"Submitt
edSucessful
l
y";
}

OUTPUT:

19
NAME:
NIHALREGNO.
3SU21SA100 LABONWEBTECHNOLOGY

PARTB

20
NAME:
NIHALREGNO.
3SU21SA100 LABONWEBTECHNOLOGY

PROGRAM: 01
Createawebappl i
cat
iont
oper
for
m Si
mpl
eLogi
nusi
ng
database.DESIGN:

CODE:
protectedv oidBut ton1_Click(objectsender,
EventAr
gse)
{
Stri
ngst r1;
SqlConnect i
oncon=newSql Connect ion(
@"Data
Source=Deskt op69\ SQLExpr ess;Ini
ti
alCatal
og=anu;
Int
egr
atedSecur
it
y=Tr
ue")
;
try
{
object
uname;
con.Open( );
str1=" sel
ect*f rom anu. dbo.t2whereusernameli
ke'
"+Text
Box1.
Text
+"'
andpasswor
d
l
ike'
"+Text Box2. Text+"'
";
SqlCommandcmd1=new
Sql Command( str
1,con) ;
uname=cmd1. ExecuteScal ar(
);
i
f( uname==nul l)
{
Label 3.
Text=" loginf ail
";
}
else
{
Label3.Text=" Loginsuccess" ;
}
con.Close( )
;
}
catch( Except i
onex)
{
Label 3.Text=ex. Message;
}
DATABASE:

21
NAME:
NIHALREGNO.
3SU21SA100 LABONWEBTECHNOLOGY

OUTPUT:

22
NAME:
NIHALREGNO.
3SU21SA100 LABONWEBTECHNOLOGY

PROGRAM:02
Creat
eawebappl
icat
iont
ocheckt
heav
ail
abi
li
tyofuser
namef
rom dat
abase.
DESIGN:

CODE:
protectedv oi dBut t
on1_Click(
objectsender ,EventArgse)
{
Str
ingst r
1;
SqlConnect i
oncon=newSql Connect i
on( @"Dat a
Source=Deskt op69\ SQLExpress;I
nit
ialCatal
og=anv i
th;I
ntegrat
edSecuri
ty=Tr
ue")
;
tr
y
{
object
uname;
con.Open( );
str1=" sel
ect*f rom anvit
h.dbo.part
b2wher euser namel
ike'"+TextBox1.
Text
+"'andpasswor dlike'"+TextBox2.Text+" '
";
SqlCommandcmd1=newSql Command( str1,
con); uname=cmd1. Execut eScal
ar();
i
f( uname! =nul l
)
{
Label 3.
Text=" Usernameav ail
able";
}
else
{
Label 3.
Text=" Usernamenotav ailable"
;
}
con.Cl ose();
}
catch( Except ionex)
{
Label 3.Text=ex. Message;
}
}

DATABASE:

23
NAME:
NIHALREGNO.
3SU21SA100 LABONWEBTECHNOLOGY

OUTPUT:

24
NAME:
NIHALREGNO.
3SU21SA100 LABONWEBTECHNOLOGY

PROGRAM NO:
03

Cr
eat
eawebappl
icat
iont
omanagecust
omeri
nfor
mat
ionusi
ngADO.
NET

dat
abase.DESI
GN:

CODE:

protectedvoidButton1_
Click(objectsender
,Ev
ent
Argse)
{
SqlConnectioncon=newSql Connect i
on(@"
Dat
a
Source=LAPTOP-KV33AEBK\ SQLExpr ess;
Ini
ti
al
Catalog=Web; I
ntegrat
edSecur i
ty=True;"
);
con.Open()
;try

{
i
ntcustID=
I
nt32.Parse(Text Box1. Text)
;Stri
ngname=
TextBox2.Text ;
StringAddr ess=Text Box 3.Text ;
StringGender=
DropDownLi st
1.SelectedItem. Text ;
intpin=
Int32.Parse( Text
Box4. Text )
;
i
ntphone=
Int32.Parse( Text
Box5. Text )
;St ri
ng
emai l=Text Box6.Text;
Stringst r
1=" i
nsertintoWeb. dbo. customerval
ues(
"+cust
ID+",
'
"+name+
"
',
'
"+Addr ess+" '
,'
"+Gender+" '
,"+pi n+" ,"+phone+" ,'
"+email+"
')
";
SqlCommandcom;
com =newSql Command( str1,
con) ;com. ExecuteNonQuer y();
con. Close();
Label 9.Text=" SavedSuccessf ul
ly" ;

}
catch(Exceptionex)
{
Label9.Text=" Techni
cal
Err
or";con.Close();
}
}

pr
otect
edv
oidBut
ton2_
Cli
ck(
obj
ectsender
,Ev
ent
Argse)
25
NAME: NIHALREGNO. 3SU21SA100 LABONWEBTECHNOLOGY
{
i
ntcust
ID=Int32.
Par
se(TextBox1.Text)
;
Sql
Connecti
oncon=newSql Connect i
on(@"
Dat
a
Source=LAPTOP-KV33AEBK\SQLExpr ess;
Ini
ti
al
Catal
og=Web;Int
egrat
edSecuri
ty=True;"
);
t
ry
{

con.Open( )
;
Str
ingst r="select*f rom Web. dbo. customerwher eIDLi
ke'
"+cust
ID
+"'";SqlCommandcmd=newSql Command( st
r,con)
;
SqlDataReaderr eader=
cmd. ExecuteReader ()
; i
f(reader.Read( ))
{
TextBox2.Text=r eader["Name" ].
ToSt ri
ng( )
;
TextBox3.Text=r eader["Address" ]
.ToString()
;
TextBox4.Text=r eader["Pi
n"].
ToSt ring();
TextBox5.Text=r eader["Phone" ]
.ToSt r
ing();
TextBox6.Text=r eader["Email"]
.ToSt r
ing();
DropDownLi st1.Text=
reader["
Gender "]
.ToSt r
ing();r
eader .Close();
}
el
se
{
Label9.Text=" Customerdet ailsnotf ound" ;
}
con.Close();

}
catch(Exceptionex)
{
Label9.Text=" Techni
cal
Err
or";con.Close();
}
}

prot
ectedvoi
dButton3_
Cli
ck(
obj
ectsender
,Ev
ent
Argse)
{
TextBox1.
Text=""
;
TextBox2.
Text=""
;
TextBox3.
Text=""
;
TextBox4.
Text=""
;
TextBox5.
Text=""
;
TextBox6.
Text=""
;
Label9.
Text=""
;
}

26
NAME:
NIHALREGNO.
3SU21SA100 LABONWEBTECHNOLOGY

OUTPUT:

27
NAME:
NIHALREGNO.
3SU21SA100 LABONWEBTECHNOLOGY

PROGRAM NO:
04

Cr
eat
eawebappl
icat
iont
omanageempl
oyeer
ecor
dandFi
lt
eri
ngby

depar
tment
.DESI
GN:

CODE
namespaceEmpl oyee
{
publi
cpart
ialclassmai n:Sy stem. Web. UI
.Page
{
prot
ectedvoidPage_ Load(obj ectsender ,Event
Argse)
{
DropDownList1.Visibl
e=f alse;
}
prot
ectedvoidBut ton1_Cli
ck( obj ectsender,Event
Argse)
{
Response.
Redi r
ect (
"AddRecor d.aspx "
);
}
prot
ectedvoidDr opDownLi st 1_Sel ect
edIndexChanged(obj
ectsender
,Event
Argse)
{
DropDownList1.Visibl
e=f alse; Response. Redir
ect(
"Di
splay
DeptWise.
aspx?Par
ameter
="+
DropDownList1.SelectedValue) ;
}
prot
ectedvoidBut ton2_Cli
ck( obj ectsender,Event
Argse)
{
Response.
Redi r
ect (
"Displ
ay .
aspx" );
}

pr
otectedvoidButton3_Cl
i
ck(obj
ectsender
,Ev
ent
Argse)
{
DropDownList1.
Visibl
e=true;
}
}
}

28
NAME:
NIHALREGNO.
3SU21SA100 LABONWEBTECHNOLOGY

DESI
GN:

C0DE:
namespaceEmpl oyee
{
publ i
cpar ti
al cl
assAddRecor d: Sy stem.Web.UI .
Page
{
SqlCommandcom; SqlConnect i
oncon; stri
ngst r;
protect edv oi
dBut ton1_Click( objectsender ,
Event Ar gse)
{
stri
ngdepar t
ment=" "
;
i
f( Radi oButton1.Checked==t rue)
depar tment=Radi oButton1. Text .ToStri
ng();
elsei f(RadioButton2. Checked
== t rue) depar t
ment = Radi oButton2.Text.
ToStr i
ng( )
;else i f
(Radi oButton3.Checked==t rue)depar tment=Radi oButt
on3. Text .
ToStri
ng();
con=newSql Connect i
on(@" Dat aSour ce=LAPTOP-
KV33AEBK\ SQLExpr ess;I
nitial Cat al
og=Web1; Int
egratedSecur it
y =True")
;
con. Open( )
;tr
y
{
str=" insertintoWeb1. dbo. emp( EmpNo, EmpName, EmpSal ary,
EmpDept )val
ues(
'"
+Tex tBox1.Text+" '
,'
"+Tex tBox 2.Text+" '
,
'"+Tex t
Box 3.
Tex t+"',
'
"+depar tment+
"'
)";com =newSql Command( str,con);
com. ExecuteNonQuer y();con.Close()
;
Label 5.Text=" Detail
ssav edsuccessf ull
y";
}
catch
{
Label 5.Text=" Thereissomeer ror";
}
}
}
}

DESI
GN:

29
NAME:
NIHALREGNO.
3SU21SA100 LABONWEBTECHNOLOGY

CODE:

namespaceEmpl oyee
{
publicparti
alclassDi splay:Sy stem.Web.UI.Page
{
SqlConnect i
oncon;
SqlCommandcom;
SqlDataAdapt eroda;
DataSetds;
protectedvoidPage_ Load(objectsender,Ev entArgse)
{
con=newSql Connect ion(@"DataSour ce=LAPTOP-
KV33AEBK\ SQLExpr ess;Ini
ti
aCat al
og=Web1; Int
egratedSecuri
ty=Tr
ue");
stri
ngst r="select*fr om Web1. dbo.emp";com =newSql Command( st
r,con)
;
con.Open( )
;oda=newSql DataAdapt er
(com) ;ds=newDat aSet
();
oda.Fil
l(ds,"
Web1. dbo. emp");
con. Cl
ose();GridView1.
DataSource=ds;
GridView1.DataBind();

}
}
}

DESI
GN:

CODE:
namespaceEmpl oy
ee
{
publi
cparti
alclassDispl
ayDept
Wise:
Syst
em.
Web.
UI.
Page
{
SqlConnecti
oncon;
SqlCommandcom;
SqlDataAdapter
oda;DataSetds;

30
NAME:NI HALREGNO. 3SU21SA100 LABONWEBTECHNOLOGY
st
ringst r
;
pr
ot ectedvoidPage_ Load(objectsender,EventAr
gse)
{
TextBox1.Text=
Request .
QueryStri
ng["
Par ameter"]
.ToStr
ing()
;con=new
SqlConnection(@"DataSour ce=LAPTOP-
KV33AEBK\ SQLExpress;I
niti
alCatalog=Web1;Int
egr
atedSecur
it
y=Tr
ue"
);

str="sel ect*fr
om Web1.dbo.empwher eEmpDeptl
i
ke'
"+Text
Box1.
Text
+"'";
com =newSql Command( st
r,con);
con.Open( );
oda=new
SqlDataAdapt er(
com);ds=
newDat aSet()
;
oda.Fil
l(ds,
"Web1. dbo.emp");
con.Close( )
;
GridView1. Dat
aMember=
"Web1. dbo.emp";Gri
dView1.DataSource
=ds; GridView1.Dat
aBind()
;

}
}
}

DATABASE:

OUTPUT1:

31
NAME:
NIHALREGNO.
3SU21SA100 LABONWEBTECHNOLOGY

OUTPUT2:

OUTPUT3:

OUTPUT4:

32
NAME:
NIHALREGNO.
3SU21SA100 LABONWEBTECHNOLOGY

PROGRAM NO05:

Cr
eateawebappli
cati
ontoperf
orm st
udenti
nformat
ionsy
stem (
Findt
otal
marks,
grade,
aver
age).Desi
gnPage1(Home.aspx

Page2(
AddSt
udent
.aspx)

Page3(
Displ
aySt
udent
.aspx)

33
NAME:
NIHALREGNO.
3SU21SA100 LABONWEBTECHNOLOGY

DATABASE:

Sour
ceCode:Home.
aspx.
cs

usi
ngSy
stem;
usi
ng

Sy
stem.
Col
l
ect
ions.
Gener

i
c;usi
ngSy
stem.
Linq;

usi
ngSy
stem.
Web;
usi
ng

Sy
stem.
Web.
UI;

usi
ngSy
stem.
Web.
UI.
WebCont
rol
s;

namespacePar
tBFi
ve

{ publ
i
cpar
ti
alcl
ass

Home:

Sy
stem.
Web.
UI.
Page

pr
otect
edv
oidBut
ton1_
Cli
ck(
obj
ectsender
,Ev
ent
Argse)

Response.
Redi
rect
("
AddSt
udent
.aspx"
);

pr
otect
edv
oidBut
ton2_
Cli
ck(
obj
ectsender
,Ev
ent
Argse)

{
34
NAME:
NIHALREGNO.
3SU21SA100 LABONWEBTECHNOLOGY

Response.
Redi
rect
("
Displ
aySt
udent
.aspx"
);

AddSt
udent
.aspx.
csusi
ng

Sy
stem;
usi
ng

Sy
stem.
Col
l
ect
ions.
Gener
i

c;
usi
ng

Sy
stem.
Dat
a.Sql
Cli
ent
;

usi
ngSy
stem.
Linq;
usi
ng

Sy
stem.
Web;

usi
ngSy
stem.
Web.
UI;
usi
ng

Sy
stem.
Web.
UI.
WebCont
rol
s;

namespacePar
tBFi
ve

{ publ
i
cpar
ti
alcl
ass

AddSt
udent:

Sy
stem.
Web.
UI.
Page

pr
otect
edv
oidBut
ton1_
Cli
ck(
obj
ectsender
,Ev
ent
Argse)

Sql
Connect
ion

con;

Sql
Command

com;

St
ri
ngst
r,gr
ade; i
nt

35
NAME:NI
HALREGNO.
3SU21SA100 LABONWEBTECHNOLOGY
m1,m2,m3,
tot
al; fl
oatav
g;

m1=

I
nt32.
Par
se(
Text
Box3.
Text
);m2

=I
nt32.
Par
se(
Text
Box4.
Text
);

m3=

I
nt32.
Par
se(
Text
Box5.
Text
);

t
otal
=m1+m2+m3;

av
g=t
otal
/3;

i
f(m1<35|
|m2<35|
|m3<35) gr
ade="
F";

el
sei
f(av
g>90&&av
g<=

100) gr
ade="
A";

el
sei
f(av
g>70&&av
g<=90)

gr
ade="
B"; el
sei
f(av
g>

50&&av
g<=70) gr
ade

="
C"; el
se gr
ade=

"
D";

con=newSqlConnect
ion(
@"DataSource=v
igneshs-
pc\
SQLEXPRESS;
I
nit
ial
Catal
og=si
mpledb;
I
ntegrat
edSecurit
y=Tr
ue"
);

con.
Open(
)

;
try

st
r="
inser
tint
oSt
udent
Inf
ovalues('
"+Text
Box1.
Text+"
'
,'"+
Text
Box2.Text+
"'
,'
"
+m1+"
'
,'"+m2+"
'
,'"+m3+"
'
,'"+t
otal
+"'
,'
"+av
g+"
'
,'"+gr
ade+

"
'
)"; com =newSql
Command(
str
,

con)
;com.
Execut
eNonQuer
y()
; con.
Close(
);

successLabel
.Text="
Det
ail
ssav
ed
36
NAME: NI
HALREGNO.
3SU21SA100 LABONWEBTECHNOLOGY
successf
ull
y";

cat
ch

successLabel
.Text="
Ther
eissomeer
ror
";

successLabel.
Visi
ble=t
rue;}
pr
otect
edv oidButton2_Cli
ck(
obj
ectsender
,Ev
ent
Argse)

Tex
tBox
1.Tex
t="
";

Tex
tBox
2.Tex
t="
";

Tex
tBox
3.Tex
t="
";

Tex
tBox
4.Tex
t="
"; Tex
tBox
5.Tex
t="
";

successLabel
.Text="
";

successLabel
.Vi
sibl
e=f
alse;

pr
otect
edv
oidLi
nkBut
ton1_
Cli
ck(
obj
ectsender
,Ev
ent
Argse)

Response.
Redi
rect
("
Home.
aspx"
);

Di
spl
aySt
udent
.aspx.
csusi
ng

Sy
stem;
usi
ng

Sy
stem.
Col
l
ect
ions.
Gener
ic;

usi
ngSy
stem.
Dat
a;usi
ng

37
NAME:NIHALREGNO. 3SU21SA100 LABONWEBTECHNOLOGY
Syst
em.Data.
Sql
Cli
ent
;

usi
ngSy
stem.
Linq;
usi
ng

Sy
stem.
Web;
usi
ng

Sy
stem.
Web.
UI;
usi
ng

Sy
stem.
Web.
UI.
WebCont
rol

s;

namespacePar
tBFi
ve

{ publ
i
cpar
ti
alcl
ass

Di
spl
aySt
udent:

Sy
stem.
Web.
UI.
Page

Sql
Connect
ion

con;

Sql
Command

com;

Sql
Dat
aAdapt
eroda; Dat
aSetds;

pr
otect
edv
oidPage_
Load(
obj
ectsender
,Ev
ent
Argse)

con=newSql
Connect
ion(
@"Dat
aSour
ce=v
igneshs-

pc\
SQLEXPRESS;
I
nit
ial
Cat
alog=si
mpl
edb;
I
ntegr
atedSecur
it
y=Tr
ue"
);

St
ri
ngst
r="
sel
ect*f
rom St
udent
Inf
o"; com =new

Sql
Command(
str
,

con)
; con.
Open(
); oda=newSql
Dat
aAdapt
er(
com)
; ds

=newDat
aSet
(); oda.
Fil
l
(ds,
"St
udent
Inf
o")
; con.
Close(
);

Gr
idVi
ew1.
Dat
aSour
ce=ds;

Gr
idVi
ew1.
Dat
aBi
nd(
);

38
NAME:NI
HALREGNO. 3SU21SA100 LABONWEBTECHNOLOGY
pr
otect
edv
oidLi
nkButt
on1_Cli
ck(
obj
ectsender
,Ev
ent
Argse)

Response.
Redi
rect
("
Home.
aspx"
);

}
OUTPUT1:

OUTPUT2:

OUTPUT3:

39

You might also like