0% found this document useful (0 votes)
8 views18 pages

Dot Net Coding

C=DOT NE MAter

Uploaded by

kovendan
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)
8 views18 pages

Dot Net Coding

C=DOT NE MAter

Uploaded by

kovendan
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/ 18

1.

JOB SEEKER’S DETAILS

Default.aspx.vb

Partial Class _Default


Inherits System.Web.UI.Page

Protected Sub Button1_Click (ByVal sender As Object, ByVal e As System.EventArgs)


Handles Button1_Click
Response.Redirect("Default2.aspx")
End Sub

Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles


Button2.Click
TextBox1.Text = " "
TextBox2.Text = " "
TextBox3.Text = " "
TextBox4.Text = " "
TextBox5.Text = " "
TextBox6.Text = " "
RadioButton1.Checked = False
RadioButton2.Checked = False
RadioButton3.Checked = False
RadioButton4.Checked = False
RadioButton5.Checked = False
RadioButton6.Checked = False
RadioButton7.Checked = False
RadioButton8.Checked = False
CheckBox1.Checked=False
CheckBox2.Checked=False
CheckBox3.Checked=False
End Sub
End Class

Default2.aspx.vb

Partial Class Default2


Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles


Me.Load
Response.Write("Your details are successfully submitted")
End Sub
End Class
JOB SEEKER’S DETAILS – INPUT

JOB SEEKER’S DETAILS – OUTPUT


2. E-MAIL REGISTRATION

Default.aspx.vb

Partial Class _Default


Inherits System.Web.UI.Page

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles


Button1.Click
Response.Redirect("Default2.aspx?Name=" + TextBox1.Text)
End Sub

Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles


Button2.Click
TextBox1.Text = " "
TextBox2.Text = " "
TextBox3.Text = " "
TextBox4.Text = " "
TextBox5.Text = " "
TextBox6.Text = " "
TextBox7.Text = " "
TextBox8.Text = " "
TextBox9.Text = " "
RadioButton1.Checked = False
RadioButton2.Checked = False
End Sub
End Class

Default2.aspx.vb

Partial Class Default2


Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles


Me.Load
If (Request.QueryString("Name") <> " ") Then
Label1.Text = "Hi " + Request.QueryString("Name") + " , your e-mail account is
successfully created"
End If
End Sub
End Class
E-MAIL REGISTRATION – INPUT

E-MAIL REGISTRATION – OUTPUT


3. E-MAIL REGISTRATION WITH VALIDATION

Default.aspx.vb

Partial Class _Default


Inherits System.Web.UI.Page

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles


Button1.Click
Response.Redirect("Default2.aspx?Name=" + TextBox1.Text)
End Sub

Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles


Button2.Click
TextBox1.Text = " "
TextBox2.Text = " "
TextBox3.Text = " "
TextBox4.Text = " "
TextBox5.Text = " "
TextBox6.Text = " "
TextBox7.Text = " "
TextBox8.Text = " "
TextBox9.Text = " "
RadioButton1.Checked = False
RadioButton2.Checked = False
End Sub
End Class

Default2.aspx.vb

Partial Class Default2


Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles


Me.Load
If (Request.QueryString("Name") <> " ") Then
Label1.Text = "Hi " + Request.QueryString("Name") + " , your e-mail account is
successfully created"
End If
End Sub
End Class
E-MAIL REGISTRATION WITH VALIDATION – INPUT

E-MAIL REGISTRATION WITH VALIDATION – OUTPUT


4. DISPLAYING FORM DATA IN A TABLE

Default.aspx.vb

Partial Class _Default


Inherits System.Web.UI.Page

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles


Button1.Click
Response.Redirect("Default2.aspx?Rollno=" & TextBox1.Text & "&Name=" &
TextBox2.Text & "&Mark1=" & TextBox3.Text & "&Mark2=" & TextBox4.Text &
"&Total=" & TextBox5.Text)
End Sub

Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles


Button2.Click
TextBox1.Text = " "
TextBox2.Text = " "
TextBox3.Text = " "
TextBox4.Text = " "
TextBox5.Text = " "
End Sub

Protected Sub TextBox4_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs)


Handles TextBox4.TextChanged
TextBox5.Text = Val(TextBox3.Text) + Val(TextBox4.Text)
End Sub
End Class

Default2.aspx.vb

Partial Class Default2


Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles


Me.Load
Response.Write("<b><center> Retrieving Form Data </center></b><br/>")
Response.Write("<table align=center width=75% border=1>")
Response.Write("<tr><th>ROLLNO</th><th>NAME</th><th>MARK1</th><th>MARK2
</th><th>TOTAL</th></tr>")
Response.Write("<tr><td>" & Request.QueryString("RollNo") & "</td><td>" &
Request.QueryString("Name") & "</td><td>" & Request.QueryString("Mark1") &
"</td><td>" & Request.QueryString("Mark2") & "</td><td>" &
Request.QueryString("Total") & "</td></tr></table>")
End Sub
End Class
DISPLAYING FORM DATA IN A TABLE – INPUT

DISPLAYING FORM DATA IN A TABLE – OUTPUT


5. INSERTING DATA USING SQL SERVER

Default.aspx.vb

Imports System.Data.SqlClient
Partial Class _Default
Inherits System.Web.UI.Page
Dim con As SqlConnection
Dim cmd As SqlCommand
Dim dr As SqlDataReader
Dim rno As Integer
Dim q1,q2 As String

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles


Me.Load
con = New SqlConnection("Data Source=ADMIN-PC\SQLEXPRESS;Initial
Catalog=Database3;Integrated Security=True;Pooling=False")
con.Open()
End Sub

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles


Button1.Click
q1="insert into Course values(" & TextBox1.Text & ",'" & TextBox2.Text & "','" &
TextBox3.Text & "')"
cmd = New SqlCommand(q1, con)
cmd.ExecuteNonQuery()
End Sub

Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles


Button2.Click
q2="select * from Course where Rollno=" & TextBox1.Text
cmd = New SqlCommand(q2, con)
dr = cmd.ExecuteReader
If dr.Read Then
TextBox2.Text = dr("Sname")
TextBox3.Text = dr("Cname")
Else
TextBox3.Text = "Record Not Available"
End If
End Sub

Protected Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles


Button3.Click
TextBox1.Text = " "
TextBox2.Text = " "
TextBox3.Text = " "
End Sub
End Class
INSERTING DATA USING SQL SERVER – INPUT

INSERTING DATA USING SQL SERVER – OUTPUT


INPUT

OUTPUT
6. UPDATING AND DELETING DATA USING SQL SERVER

Default.aspx.vb

Imports System.Data.SqlClient
Partial Class _Default
Inherits System.Web.UI.Page
Dim con As SqlConnection
Dim cmd As SqlCommand
Dim dr As SqlDataReader
Dim rno As Integer
Dim q1,q2,q3 As String

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles


Me.Load
con = New SqlConnection("Data Source=ADMIN-PC\SQLEXPRESS;Initial
Catalog=Database3;Integrated Security=True;Pooling=False")
con.Open()
End Sub

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles


Button1.Click
q1="select * from Course where Rollno=" & TextBox1.Text
cmd = New SqlCommand(q1, con)
dr = cmd.ExecuteReader
If dr.Read Then
TextBox2.Text = dr("Sname")
TextBox3.Text = dr("Cname")
Else
TextBox3.Text = "Record Not Available"
End If
End Sub

Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles


Button2.Click
q2= update Course set Cname='" & TextBox3.Text & "' " & "where Rollno=" &
TextBox1.Text
cmd = New SqlCommand(q2, con)
cmd.ExecuteNonQuery()
End Sub

Protected Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles


Button3.Click
q3= "delete from Course where Rollno=" & TextBox1.Text
cmd = New SqlCommand(q3, con)
cmd.ExecuteNonQuery()
End Sub
Protected Sub Button4_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles
Button4.Click
TextBox1.Text = " "
TextBox2.Text = " "
TextBox3.Text = " "
End Sub

End Class
UPDATING AND DELETING DATA USING SQL SERVER – INPUT

UPDATING AND DELETING DATA USING SQL SERVER – OUTPUT


7. WEB PAGE USING DATA GRID CONTROL

Default.aspx.vb

Imports System.Data.SqlClient
Imports System.Data

Partial Class _Default


Inherits System.Web.UI.Page
Dim con As SqlConnection
Dim cmd As SqlCommand
Dim dS As DataSet
Dim da As SqlDataAdapter

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles


Me.Load
con = New SqlConnection("Data Source=ADMIN-PC\SQLEXPRESS;Initial
Catalog=Database3;Integrated Security=True;Pooling=False")
con.Open()
End Sub

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles


Button1.Click
cmd = New SqlCommand("select * from employee", con)
da = New SqlDataAdapter(cmd)
dS = New DataSet()
da.Fill(dS)
DataGrid1.DataSource = dS
DataGrid1.DataBind()
End Sub
End Class
WEB PAGE USING DATA GRID CONTROL – INPUT

WEB PAGE USING DATA GRID CONTROL – OUTPUT


8. WEB PAGE USING DATA LIST CONTROL

Default.aspx.vb

Imports System.Data.SqlClient

Imports System.Data
Partial Class _Default
Inherits System.Web.UI.Page
Dim con As SqlConnection
Dim cmd As SqlCommand
Dim dS As DataSet
Dim da As SqlDataAdapter

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles


Button1.Click
cmd = New SqlCommand("select * from employee", con)
da = New SqlDataAdapter(cmd)
dS = New DataSet()
da.Fill(dS)
DataList1.DataSource = dS
DataList1.DataBind()
End Sub

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles


Me.Load
con = New SqlConnection("Data Source=ADMIN-PC\SQLEXPRESS;Initial
Catalog=Database3;Integrated Security=True;Pooling=False")
con.Open()
End Sub
End Class
WEB PAGE USING DATA LIST CONTROL - INPUT

WEB PAGE USING DATA LIST CONTROL - OUTPUT

You might also like