0% found this document useful (0 votes)
14 views11 pages

Ass 2

Uploaded by

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

Ass 2

Uploaded by

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

Name:- Saiyed Ahmad Kamruddin

Class:- T.Y.B.C.A 5th Sem.


Roll No.:-27
ASS -2(1). Create web application to display all the data of
student table using Data Reader.
Imports System.Data.OleDb
Partial Class _Default
Inherits System.Web.UI.Page

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As


System.EventArgs) Handles Button1.Click
Dim con As New
OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=G:\
Backups\Vishal\Student.mdb")
Dim com As New OleDbCommand("select * from Student", con)
Dim dr As OleDbDataReader
con.Open()
dr = com.ExecuteReader()
GridView1.DataSource = dr
GridView1.DataBind()
con.Close()
End Sub
End Class
Name:- Saiyed Ahmad Kamruddin
Class:- T.Y.B.C.A 5th Sem.
Roll No.:-27
ASS -2(2). Create web application to display all the data of
student table using Dataset & Data Adapter.
Imports System.Data.OleDb
Partial Class Default2
Inherits System.Web.UI.Page
Dim con As New
OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=G:\Backups\Vishal\Student.mdb")
Dim com As New OleDbCommand("select * from Student", con)
Dim ds As New Data.DataSet
Dim da As New OleDbDataAdapter(com)

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As


System.EventArgs) Handles Button1.Click
con.Open()
ds.Clear()
da.Fill(ds)
GridView1.DataSource = ds.Tables(0)
GridView1.DataBind()
con.Close()
End Sub
End Class
Name:- Saiyed Ahmad Kamruddin
Class:- T.Y.B.C.A 5th Sem.
Roll No.:-27
ASS -2(3). Create web application to Insert, Update, Delete and
Display data of student table also used validation control.
Imports System.Data.OleDb
Partial Class Default3
Inherits System.Web.UI.Page
Dim con As New
OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;D ata Source=G:\
Backups\Vishal\Student.mdb")
Dim com As New OleDbCommand("select * from Student", con)
Dim ds As New Data.DataSet
Dim da As New OleDbDataAdapter(com)
Public Sub disp()
con.Open()
ds.Clear()
da.Fill(ds)
GridView1.DataSource = ds.Tables(0)
GridView1.DataBind()
con.Close()
End Sub

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As


System.EventArgs) Handles Button1.Click
Dim com As New OleDbCommand("insert into Student values('" +
TextBox1.Text + "','" + TextBox2.Text + "','" + TextBox3.Text + "','" +
TextBox4.Text + "')", con)
con.Open()
com.ExecuteNonQuery()
con.Close()
disp()
End Sub
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button2.Click
Dim s As String
s = InputBox("Enter Number To Update ")
Dim com As New OleDbCommand("update Student set Roll_NO='" +
TextBox1.Text + "',Name='" + TextBox2.Text + "',Class='" + TextBox3.Text +
"',Phone='" + TextBox4.Text + "' where Roll_NO='" + s + "'", con)
con.Open()
com.ExecuteNonQuery()
con.Close()
disp()
End Sub

Protected Sub Button3_Click(ByVal sender As Object, ByVal e As


System.EventArgs) Handles Button3.Click
Dim s As String
s = InputBox("Enter Number To Delete!")
Dim com As New OleDbCommand("delete from Student where Roll_NO='" + s
+ "'", con)
con.Open()
com.ExecuteNonQuery()
con.Close()
disp()
End Sub

Protected Sub Button4_Click(ByVal sender As Object, ByVal e As


System.EventArgs) Handles Button4.Click
disp()
End Sub
End Class
Name:- Saiyed Ahmad Kamruddin
Class:- T.Y.B.C.A 5th Sem.
Roll No.:-27
ASS -2(4). Create web application to used of two tables
employee and department define relationship.

Imports System.Data.OleDb
Partial Class Default4
Inherits System.Web.UI.Page
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim con As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=G:\Backups\Vishal\department.mdb")
Dim str As String = "select a.empno,a.sname,a.salary,b.dept from emp1
a,dept1 b where a.empno=b.empno"
Dim com As New OleDbCommand(str, con)
Dim ds As New Data.DataSet
Dim da As New OleDbDataAdapter(com)
con.Open()
da.Fill(ds)
GridView1.DataSource = ds.Tables(0)
GridView1.DataBind()
con.Close()

End Sub
End Class
Name:- Saiyed Ahmad Kamruddin
Class:- T.Y.B.C.A 5th Sem.
Roll No.:-27
ASS -2(5). Create web application to search perticular student
record using student name.
Imports System.Data.OleDb
Partial Class Default5
Inherits System.Web.UI.Page
Dim con As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=G:\Backups\Vishal\Student.mdb")
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim str As String
str = "select * from stud where name like '" + TextBox1.Text + "'"
Dim cmd As New OleDbCommand(str, con)
Dim dr As OleDbDataReader
dr = cmd.ExecuteReader
GridView1.DataSource = dr
GridView1.DataBind()
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load
con.open()
End Sub
End Class

You might also like