707 ASP Assignment
707 ASP Assignment
1.Create a web page to demonstrate use of master page using themes, CSS.
Answer:
Design:
Output:
Output:
3. Create the application that accepts name, password, age, email id, and user id. All the information
entry is compulsory. Password should be reconfirmed. Age should be within 21 to 30. Email id should
be valid. User id should have at least a capital letter and digit as well as length should be between 7
and 20 characters.
Answer:
Design:
707-tybca 1
2 505 – Practical Assignment
Output:
- Create a web page to insert data with proper validation in above table and display data in gridview
control using coding.
Answer:
Design:
Source:
Imports System.Data.SqlClient
Imports System.Data
Imports System.IO
707-tybca 2
3 505 – Practical Assignment
Try
cmd.CommandText = "insert into tblnews values('" & TextBox1.Text & "','" & Calendar1.SelectedDate & "')"
con.Open()
cmd.ExecuteNonQuery()
Catch ex As Exception
Label1.Text = ex.Message
End Try
fillgrid()
clearcontrols()
con.Close()
End Sub
Sub fillgrid()
Try
cmd.CommandText = "select * from tblnews"
da = New SqlDataAdapter(cmd)
dt = New DataTable
da.Fill(dt)
GridView1.DataSource = dt
GridView1.DataBind()
Catch ex As Exception
Label1.Text = ex.Message
End Try
End Sub
Sub clearcontrols()
TextBox1.Text = ""
End Sub
Output:
Design:
Output:
- Create a Web page to display all the news details provide the update and delete facility on it.
Answer:
Design:
707-tybca 3
4 505 – Practical Assignment
Source:
Imports System.Data.SqlClient
Imports System.Data
Imports System.IO
Sub fillgrid()
Try
cmd.CommandText = "select * from tblnews"
da = New SqlDataAdapter(cmd)
dt = New DataTable
da.Fill(dt)
GridView1.DataSource = dt
GridView1.DataBind()
Catch ex As Exception
Label1.Text = ex.Message
End Try
End Sub
Sub clearcontrols()
TextBox1.Text = ""
End Sub
707-tybca 4
5 505 – Practical Assignment
End Try
End Sub
lblid.Text = nid.Text
TextBox1.Text = ndtl.Text
CALENDAR1.SelectedDate = ndate.Text
Catch ex As Exception
Label1.Text = ex.Message
End Try
End Sub
End Class
Output:
Design:
Source:
Imports System.Data.SqlClient
Imports System.Data
Imports System.IO
707-tybca 5
6 505 – Practical Assignment
Sub fillgrid()
Try
cmd.CommandText = "select * from tblnews1"
da = New SqlDataAdapter(cmd)
dt = New DataTable
da.Fill(dt)
GridView1.DataSource = dt
GridView1.DataBind()
Catch ex As Exception
Label1.Text = ex.Message
End Try
End Sub
Protected Sub btnsearch_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnsearch.Click
Dim sdate As String = Calendar1.SelectedDate
Try
cmd.CommandText = "select * from tblnews1 where newsdate = '" & sdate & "' "
con.Open()
cmd.ExecuteNonQuery()
Catch ex As Exception
Label1.Text = ex.Message
End Try
searchfillgrid()
Label1.Text = sdate
con.Close()
End Sub
Sub searchfillgrid()
da = New SqlDataAdapter(cmd)
dt = New DataTable
da.Fill(dt)
GridView1.DataSource = dt
GridView1.DataBind()
End Sub
End Class
Output:
- Create a web page that provide insert, update and delete functionality with proper validation.
Answer:
Design:
707-tybca 6
7 505 – Practical Assignment
Source:
Imports System.Data.SqlClient
Imports System.Data
Imports System.IO
Sub fillgrid()
Try
cmd.CommandText = "select * from tblemp order by deptid"
da = New SqlDataAdapter(cmd)
dt = New DataTable
da.Fill(dt)
GridView1.DataSource = dt
GridView1.DataBind()
Catch ex As Exception
Label1.Text = ex.Message
End Try
End Sub
Catch ex As Exception
Label1.Text = ex.Message
End Try
fillgrid()
clearcontrols()
con.Close()
End Sub
707-tybca 7
8 505 – Practical Assignment
Sub clearcontrols()
TextBox2.Text = ""
TextBox3.Text = ""
End Sub
Sub getdeptid()
Try
did = DropDownList1.SelectedIndex + 101
Catch ex As Exception
Label1.Text = ex.Message
End Try
End Sub
cmd.CommandText = "delete from tblemp where deptid = " & d_did & " and empname = '" & d_empname
& "' "
con.Open()
cmd.ExecuteNonQuery()
Catch ex As Exception
Label1.Text = ex.Message
End Try
fillgrid()
con.Close()
End Sub
DropDownList1.SelectedValue = ldname.Text
TextBox2.Text = lename.Text
TextBox3.Text = lsalary.Text
Label1.Text = DropDownList1.SelectedIndex + 101
Button1.Text = "Update"
Catch ex As Exception
Label1.Text = ex.Message
End Try
End Sub
End Class
Output:
707-tybca 8
9 505 – Practical Assignment
Answer:
Design:
Source:
Imports System.Data.SqlClient
Imports System.Data
Imports System.IO
Sub fillgrid()
Try
cmd.CommandText = "select * from tblemp order by deptid"
da = New SqlDataAdapter(cmd)
dt = New DataTable
da.Fill(dt)
DataList1.DataSource = dt
DataList1.DataBind()
Catch ex As Exception
End Try
End Sub
End Class
Output:
Design:
Source:
Imports System.Data.SqlClient
Imports System.Data
Imports System.IO
707-tybca 9
10 505 – Practical Assignment
Sub fillgrid()
Try
cmd.CommandText = "select * from tblemp order by deptid"
da = New SqlDataAdapter(cmd)
dt = New DataTable
da.Fill(dt)
Repeater1.DataSource = dt
Repeater1.DataBind()
Catch ex As Exception
End Try
End Sub
End Class
Output:
Design:
Source:
Imports System.Data.SqlClient
Imports System.Data
Imports System.IO
707-tybca 10
11 505 – Practical Assignment
da.Fill(dt)
FormView1.DataSource = dt
FormView1.DataBind()
Catch ex As Exception
End Try
End Sub
End Class
Output:
6. Create a Login page. After successfully login, page is redirect to home page, which displays
Username and logout option.
Answer:
707-tybca 11
12 505 – Practical Assignment
7. Create website using .net technology for online shopping of gifts. Give facility to register as admin
who can add various categories of gifts. The admin can also add, update or delete any gift articles on
the site. Users can register and view various gift articles and place orders using COD mode only.
Answer:
Source:
Imports System.Data.SqlClient
Imports System.Data
Imports System.IO
Inherits System.Web.UI.Page
Dim da As SqlDataAdapter
Dim dt As DataTable
lbladmin.Text = Session("admin")
707-tybca 12
13 505 – Practical Assignment
Try
con.ConnectionString = constring
cmd.Connection = con
Catch ex As Exception
lblerror.Text = ex.Message
End Try
fillgrid()
img_main.Visible = False
End Sub
Sub fillgrid()
Try
cmd.CommandText = "select * from tblgiftmaster where admin='" & lbladmin.Text & "'"
da = New SqlDataAdapter(cmd)
dt = New DataTable
da.Fill(dt)
GridView1.DataSource = dt
GridView1.DataBind()
Catch ex As Exception
lblerror.Text = ex.Message
End Try
End Sub
Try
FileUpload1.SaveAs(Server.MapPath("~/images/") + FileUpload1.FileName)
End If
cmd.CommandText = "insert into tblgiftmaster values('" & txtgname.Text & "','" & txtgprice.Text & "','" &
lbladmin.Text & "','" & filepath & "')"
Else
FileUpload1.SaveAs(Server.MapPath("~/images/”) +FileUpload1.FileName)
flag = True
If File.Exists(dimg) Then
File.Delete(dimg)
End If
img_main.Visible = False
End If
707-tybca 13
14 505 – Practical Assignment
If flag Then
cmd.CommandText = "update tblgiftmaster set gname='" & txtgname.Text & "',gprice='" &
txtgprice.Text & "',filepath='" & filepath1 & "' where gid = " & lblerror.Text & ""
Else
cmd.CommandText = "update tblgiftmaster set gname='" & txtgname.Text & "',gprice='" &
txtgprice.Text & "' where gid = " & lblerror.Text & ""
End If
End If
con.Open()
cmd.ExecuteNonQuery()
Catch ex As Exception
lblerror.Text = ex.Message
End Try
fillgrid()
con.Close()
txtgname.Text = ""
txtgprice.Text = ""
End Sub
Try
GridView1.PageIndex = e.NewPageIndex
fillgrid()
Catch ex As Exception
lblerror.Text = ex.Message
End Try
End Sub
Try
cmd.CommandText = "delete from tblgiftmaster where gid =" & gid & " "
con.Open()
cmd.ExecuteNonQuery()
If File.Exists(fileexists) Then
File.Delete(fileexists)
End If
Catch ex As Exception
lblerror.Text = ex.Message
End Try
707-tybca 14
15 505 – Practical Assignment
fillgrid()
con.Close()
End Sub
Try
img_main.Visible = True
g_admin=CType(GridView1.SelectedRow.FindControl("lbl_admin"), Label)
lblerror.Text = g_id.Text
txtgname.Text = g_name.Text
txtgprice.Text = g_price.Text
img_main.ImageUrl = gimage.ImageUrl
Button_Main.Text = "Update"
Catch ex As Exception
lblerror.Text = ex.Message
End Try
End Sub
End Class
OutPut:
Source of User:
Imports System.Data.SqlClient
Imports System.Data
Imports System.IO
Inherits System.Web.UI.Page
707-tybca 15
16 505 – Practical Assignment
Dim da As SqlDataAdapter
Dim dt As DataTable
Label1.Text = Session("User")
Try
con.ConnectionString = constring
cmd.Connection = con
Catch ex As Exception
End Try
filldatalist()
End Sub
Sub filldatalist()
Try
da = New SqlDataAdapter(cmd)
dt = New DataTable
da.Fill(dt)
GridView1.DataSource = dt
GridView1.DataBind()
Catch ex As Exception
End Try
End Sub
Try
g_admin=CType(GridView1.SelectedRow.FindControl("lbl_admin"), Label)
lblggid.Text = g_id.Text
Response.Redirect("~/Product.aspx?gid=" & g_id.Text & "&gname=" & g_name.Text & "&gprice=" &
g_price.Text & "&admin=" & g_admin.Text & "&image=" & image.ImageUrl)
Catch ex As Exception
End Try
End Sub
707-tybca 16
17 505 – Practical Assignment
Try
GridView1.PageIndex = e.NewPageIndex
filldatalist()
Catch ex As Exception
lblggid.Text = ex.Message
End Try
End Sub
End Class
Product Design:
Source of Product:
Inherits System.Web.UI.Page
Label1.Text = Request.QueryString("gid")
lblname.Text = Request.QueryString("gname")
lblprice.Text = Request.QueryString("gprice")
lblseller.Text = Request.QueryString("admin")
Image1.ImageUrl = Request.QueryString("image")
End Sub
MultiView1.ActiveViewIndex = 0
Label2.Text = lblprice.Text
End Sub
MultiView1.ActiveViewIndex = -1
End Sub
707-tybca 17
18 505 – Practical Assignment
If RadioButton1.Checked Then
Label3.Text = ""
Response.Redirect("~/Userhome.aspx")
Else
End If
End Sub
End Class
8. Create .NET based module that can be used for online missing person registration and processing
site where user can register and enter information about missing person. Create appropriate tables
and provide appropriate validations.
Answer:
Design:
Source:
Imports System.Data.SqlClient
Imports System.Data
Inherits System.Web.UI.Page
Try
con.ConnectionString = constring
cmd.Connection = con
Catch ex As Exception
End Try
End Sub
Protected Sub Button1_Click (ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
707-tybca 18
19 505 – Practical Assignment
FileUpload1.SaveAs(Server.MapPath("~/images/") + FileUpload1.FileName)
End If
If RadioButton1.Checked Then
gender = "Male"
End If
If RadioButton2.Checked Then
gender = "Female"
End If
Try
cmd.CommandText = "insert into tblmissingperson values('" & TextBox1.Text & "','" & TextBox2.Text & "'," &
TextBox3.Text & ",'" & gender & "','" & Calendar1.SelectedDate & "','" & Calendar2.SelectedDate & "','" &
TextBox4.Text & "','" & TextBox5.Text & "','" & filepath & "')"
con.Open()
cmd.ExecuteNonQuery()
Catch ex As Exception
End Try
con.Close()
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
RadioButton1.Checked = False
RadioButton2.Checked = False
End Sub
End Class
9. Design module using ASP.NET "shoponline" for online shopping which provide online
shopping items like jeans shirts, shirt etc. It includes view of items along with their price.
Add selected items into cart and display shipping details. Provide proper validation.
Answer:
Source:
Imports System.Data
707-tybca 19
20 505 – Practical Assignment
Inherits System.Web.UI.Page
Dim data As DataTable = db.getData("select * from tblcart where uid = 1 and pid = " & productId & "")
Return
End If
End Sub
End Class
Dbhelper class:
Imports Microsoft.VisualBasic
Imports System.Data.SqlClient
Imports System.Data
Sub New()
cmd.Connection = con
End Sub
cmd.CommandText = query
con.Open()
cmd.ExecuteNonQuery()
con.Close()
End Sub
cmd.CommandText = query
con.Open()
da.Fill(dt)
con.Close()
Return dt
End Function
707-tybca 20
21 505 – Practical Assignment
End Class
Source:
Imports System.Data
Inherits System.Web.UI.Page
lblUserName.Text = data.Rows(0).Item(1)
lblAddress.Text = data.Rows(0).Item(2)
lblCity.Text = data.Rows(0).Item(4)
lblState.Text = data.Rows(0).Item(3)
End Sub
End Class
10. Design module using ASP.NET "online book shop" for online book shopping. User can view the
different category of books and place an order for book. Admin can manage the book stock. Provide
proper validation.
Answer:
Imports System.Data.SqlClient
Imports System.Data
Imports System.IO
Inherits System.Web.UI.Page
707-tybca 21
22 505 – Practical Assignment
Dim da As SqlDataAdapter
Dim dt As DataTable
Try
con.ConnectionString = constring
cmd.Connection = con
Catch ex As Exception
End Try
fillgrid()
End Sub
Sub fillgrid()
da = New SqlDataAdapter(cmd)
dt = New DataTable
da.Fill(dt)
GridView1.DataSource = dt
GridView1.DataBind()
End Sub
Response.Redirect("~/Product.aspx?bid=" & bid.Text & "&bname=" & bname.Text & "&bprice=" & bprice.Text
& "&stock=" & stock.Text)
End Sub
End Class
Inherits System.Web.UI.Page
Label1.Text = Request.QueryString("bid")
Label2.Text = Request.QueryString("bname")
707-tybca 22
23 505 – Practical Assignment
Label3.Text = Request.QueryString("bprice")
End Sub
Response.Redirect("~/user.aspx")
End Sub
End Class
Imports System.Data.SqlClient
Imports System.Data
Imports System.IO
Inherits System.Web.UI.Page
Dim da As SqlDataAdapter
Dim dt As DataTable
Try
con.ConnectionString = constring
cmd.Connection = con
Catch ex As Exception
lblerror.Text = ex.Message
End Try
fillgrid()
End Sub
Sub fillgrid()
da = New SqlDataAdapter(cmd)
dt = New DataTable
da.Fill(dt)
GridView1.DataSource = dt
GridView1.DataBind()
End Sub
707-tybca 23
24 505 – Practical Assignment
Try
cmd.CommandText = "insert into tblbook values('" & TextBox1.Text & "','" & TextBox2.Text & "','" &
TextBox3.Text & "')"
Else
cmd.CommandText = "update tblbook set bname='" & TextBox1.Text & "',stock='" & TextBox2.Text &
"',bprice='" & TextBox3.Text & "' where bid = " & lblid.Text & ""
Button_main.Text = "Insert"
lblid.Text = ""
End If
con.Open()
cmd.ExecuteNonQuery()
Catch ex As Exception
lblerror.Text = ex.Message
End Try
fillgrid()
con.Close()
clear()
End Sub
Sub clear()
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
End Sub
Try
con.Open()
cmd.ExecuteNonQuery()
Catch ex As Exception
lblerror.Text = ex.Message
End Try
fillgrid()
con.Close()
End Sub
Try
707-tybca 24
25 505 – Practical Assignment
lblid.Text = bid.Text
TextBox1.Text = bname.Text
TextBox2.Text = stock.Text
TextBox3.Text = bprice.Text
Button_main.Text = "Update"
Catch ex As Exception
lblerror.Text = ex.Message
End Try
End Sub
End Class
11. Create interactive pages using .NET which accept Information pertaining to Airline booking. It
store information in the database using entry form and display information for given Booking-id. Use
following table for this purpose: Bookig master (booking_id, booking date, Name, address, contact_no,
Source_Place, Destination_Place). Provide appropriate validations.
Answer:
Design:
Source:
Imports System.Data.SqlClient
Imports System.Data
Imports System.IO
Inherits System.Web.UI.Page
Dim da As SqlDataAdapter
Dim dt As DataTable
Try
con.ConnectionString = constring
cmd.Connection = con
Catch ex As Exception
Label1.Text = ex.Message
707-tybca 25
26 505 – Practical Assignment
End Try
End Sub
Try
cmd.CommandText = "insert into tblbooking values('" & Calendar2.SelectedDate & "','" & TextBox1.Text &
"','" & TextBox2.Text & "','" & TextBox3.Text & "','" & TextBox4.Text & "')"
con.Open()
cmd.ExecuteNonQuery()
Catch ex As Exception
Label1.Text = ex.Message
End Try
con.Close()
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
End Sub
Try
cmd.CommandText = "select * from tblbooking where bid=" & TextBox5.Text & ""
da = New SqlDataAdapter(cmd)
dt = New DataTable
da.Fill(dt)
GridView1.DataSource = dt
GridView1.DataBind()
Catch ex As Exception
End Try
End Sub
End Class
12. Create a website for Domino’s Pizza and give facility for ordering items. Maintain session for
logged in users.
Answer:
Design:
Source:
Imports System.Data.SqlClient
Imports System.Data
707-tybca 26
27 505 – Practical Assignment
Imports System.IO
Inherits System.Web.UI.Page
Dim da As SqlDataAdapter
Dim dt As DataTable
Try
con.ConnectionString = constring
cmd.Connection = con
Catch ex As Exception
End Try
fillgrid()
End Sub
Sub fillgrid()
da = New SqlDataAdapter(cmd)
dt = New DataTable
da.Fill(dt)
GridView1.DataSource = dt
GridView1.DataBind()
End Sub
Try
Catch ex As Exception
End Try
End Sub
End Class
707-tybca 27
28 505 – Practical Assignment
Inherits System.Web.UI.Page
Image1.ImageUrl = Request.QueryString("photo")
Label1.Text = Request.QueryString("price")
End Sub
Response.Redirect("~/Default2.aspx")
End Sub
End Class
13. Develop a .NET application for "E-Shopping system" will provide features like:
- Create appropriate database tables for this and provide appropriate validations.
Answer:
Source:
Imports System.Data.SqlClient
Imports System.Data
Imports System.IO
Inherits System.Web.UI.Page
Dim da As SqlDataAdapter
Dim dt As DataTable
707-tybca 28
29 505 – Practical Assignment
lbladmin.Text = Session("admin")
Try
con.ConnectionString = constring
cmd.Connection = con
Catch ex As Exception
lblerror.Text = ex.Message
End Try
fillgrid()
img_main.Visible = False
End Sub
Sub fillgrid()
Try
cmd.CommandText = "select * from tblgiftmaster where admin='" & lbladmin.Text & "'"
da = New SqlDataAdapter(cmd)
dt = New DataTable
da.Fill(dt)
GridView1.DataSource = dt
GridView1.DataBind()
Catch ex As Exception
lblerror.Text = ex.Message
End Try
End Sub
Try
FileUpload1.SaveAs(Server.MapPath("~/images/") + FileUpload1.FileName)
End If
cmd.CommandText = "insert into tblgiftmaster values('" & txtgname.Text & "','" & txtgprice.Text & "','" &
lbladmin.Text & "','" & filepath & "')"
Else
FileUpload1.SaveAs(Server.MapPath("~/images/")+FileUpload1.FileName)
flag = True
If File.Exists(dimg) Then
File.Delete(dimg)
707-tybca 29
30 505 – Practical Assignment
End If
img_main.Visible = False
End If
If flag Then
cmd.CommandText = "update tblgiftmaster set gname='" & txtgname.Text & "',gprice='" &
txtgprice.Text & "',filepath='" & filepath1 & "' where gid = " & lblerror.Text & ""
Else
cmd.CommandText = "update tblgiftmaster set gname='" & txtgname.Text & "',gprice='" &
txtgprice.Text & "' where gid = " & lblerror.Text & ""
End If
End If
con.Open()
cmd.ExecuteNonQuery()
Catch ex As Exception
lblerror.Text = ex.Message
End Try
fillgrid()
con.Close()
txtgname.Text = ""
txtgprice.Text = ""
End Sub
Try
GridView1.PageIndex = e.NewPageIndex
fillgrid()
Catch ex As Exception
lblerror.Text = ex.Message
End Try
End Sub
Try
cmd.CommandText = "delete from tblgiftmaster where gid=" & gid & " "
con.Open()
cmd.ExecuteNonQuery()
If File.Exists(fileexists) Then
File.Delete(fileexists)
End If
707-tybca 30
31 505 – Practical Assignment
Catch ex As Exception
lblerror.Text = ex.Message
End Try
fillgrid()
con.Close()
End Sub
Try
img_main.Visible = True
lblerror.Text = g_id.Text
txtgname.Text = g_name.Text
txtgprice.Text = g_price.Text
img_main.ImageUrl = gimage.ImageUrl
Button_Main.Text = "Update"
Catch ex As Exception
lblerror.Text = ex.Message
End Try
End Sub
End Class
Technician:
- Login
Registered user:
Answer:
707-tybca 31
32 505 – Practical Assignment
Imports System.Data.SqlClient
Imports System.Data
Inherits System.Web.UI.Page
Dim da As SqlDataAdapter
Dim dt As DataTable
Try
con.ConnectionString = constring
cmd.Connection = con
Catch ex As Exception
End Try
fillgrid()
End Sub
Sub fillgrid()
da = New SqlDataAdapter(cmd)
dt = New DataTable
da.Fill(dt)
GridView1.DataSource = dt
GridView1.DataBind()
End Sub
Try
Label1.Text = cid.Text
RadioButton1.Checked = True
End If
RadioButton2.Checked = True
End If
707-tybca 32
33 505 – Practical Assignment
RadioButton3.Checked = True
End If
TextBox1.Text = complaint.Text
DropDownList1.SelectedIndex = 0
End If
DropDownList1.SelectedIndex = 1
End If
Catch ex As Exception
End Try
End Sub
Try
cmd.CommandText = "update tblcomplaint set state='" & DropDownList1.SelectedValue & "' where cid=" &
Label1.Text & ""
con.Open()
cmd.ExecuteNonQuery()
Catch ex As Exception
End Try
fillgrid()
con.Close()
DropDownList1.SelectedIndex = 0
TextBox1.Text = ""
RadioButton1.Checked = False
RadioButton2.Checked = False
RadioButton3.Checked = False
End Sub
End Class
Source:
Imports System.Data.SqlClient
Imports System.Data
Inherits System.Web.UI.Page
707-tybca 33
34 505 – Practical Assignment
If RadioButton1.Checked Then
com = RadioButton1.Text
End If
If RadioButton2.Checked Then
com = RadioButton2.Text
End If
If RadioButton3.Checked Then
com = RadioButton3.Text
End If
Try
cmd.CommandText = "insert into tblcomplaint values('" & com & "','" & TextBox1.Text & "','" & s & "')"
con.Open()
cmd.ExecuteNonQuery()
Catch ex As Exception
End Try
con.Close()
TextBox1.Text = ""
RadioButton1.Checked = False
RadioButton2.Checked = False
RadioButton3.Checked = False
End Sub
Try
con.ConnectionString = constring
cmd.Connection = con
Catch ex As Exception
End Try
End Sub
End Class
15. Develop the "Missing Person Information Management System" for police department by
Answer:
Design:
707-tybca 34
35 505 – Practical Assignment
Source:
Imports System.Data.SqlClient
Imports System.Data
Inherits System.Web.UI.Page
Try
con.ConnectionString = constring
cmd.Connection = con
Catch ex As Exception
End Try
End Sub
FileUpload1.SaveAs(Server.MapPath("~/images/") + FileUpload1.FileName)
End If
If RadioButton1.Check
gender = "Male"
End If
If RadioButton2.Checked Then
gender = "Female"
End If
Try
cmd.CommandText = "insert into tblmissingperson values('" & TextBox1.Text & "','" & TextBox2.Text & "'," &
TextBox3.Text & ",'" & gender & "','" & Calendar1.SelectedDate & "','" & Calendar2.SelectedDate & "','" &
TextBox4.Text & "','" & TextBox5.Text & "','" & filepath & "')"
con.Open()
cmd.ExecuteNonQuery()
Catch ex As Exception
End Try
con.Close()
TextBox1.Text = ""
707-tybca 35
36 505 – Practical Assignment
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
RadioButton1.Checked = False
RadioButton2.Checked = False
End Sub
End Class
16. Develop module using .NET to keep track of visitors in museum which stores visitor’s details like
name, time of visit, date of visit, contact no, etc. Also give facility to search and display visitor’s data
based on the date visited.
Answer:
Design:
Source:
Dbhelper class:
Imports Microsoft.VisualBasic
Imports System.Data.SqlClient
Imports System.Data
Sub New()
cmd.Connection = con
End Sub
cmd.CommandText = query
con.Open()
cmd.ExecuteNonQuery()
con.Close()
End Sub
cmd.CommandText = query
con.Open()
707-tybca 36
37 505 – Practical Assignment
da.Fill(dt)
con.Close()
Return dt
End Function
End Class
Inherits System.Web.UI.Page
Dim insertQuery As String = "INSERT INTO VisitorRecords (Name, DateOfVisit, ContactNo, Email) " & _
"VALUES ('" & txtname.Text & "', '" & dt.SelectedDate.ToString("yyyy-MM-dd") & "', '" & txtcon.Text & "', '" &
txtemail.Text & "')"
db.exeQuery(insertQuery)
End Sub
End Class
Source:
Inherits System.Web.UI.Page
GridView1.DataBind()
End Sub
GridView1.DataBind()
End Sub
End Class
707-tybca 37