See Video Here
Public Class Form1
Dim con As New OleDb.OleDbConnection
Dim ds As New DataSet
Dim da As New OleDb.OleDbDataAdapter
Dim cmd As New OleDb.OleDbCommand
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
con.ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\Ramdas\Documents\auth.mdb"
con.Open()
da = New OleDb.OleDbDataAdapter("select * from auther", con)
da.Fill(ds, "ath")
DataGridView1.DataSource = ds.Tables("ath")
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim q As String
Dim x As Integer
q = "delete from auther where bname='VB.NET'"
cmd = New OleDb.OleDbCommand(q, con)
Try
x = cmd.ExecuteNonQuery()
If (x) Then
MsgBox("Data Deleted")
Else
MsgBox("Data not deleted")
End If
ds.Tables.Clear()
da = New OleDb.OleDbDataAdapter("select * from auther", con)
da.Fill(ds, "ath")
DataGridView1.DataSource = ds.Tables("ath")
Catch ex As Exception
MsgBox("Exception Occured")
End Try
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Form2.Show()
End Sub
End Class
Public Class Form1
Dim con As New OleDb.OleDbConnection
Dim ds As New DataSet
Dim da As New OleDb.OleDbDataAdapter
Dim cmd As New OleDb.OleDbCommand
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
con.ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\Ramdas\Documents\auth.mdb"
con.Open()
da = New OleDb.OleDbDataAdapter("select * from auther", con)
da.Fill(ds, "ath")
DataGridView1.DataSource = ds.Tables("ath")
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim q As String
Dim x As Integer
q = "delete from auther where bname='VB.NET'"
cmd = New OleDb.OleDbCommand(q, con)
Try
x = cmd.ExecuteNonQuery()
If (x) Then
MsgBox("Data Deleted")
Else
MsgBox("Data not deleted")
End If
ds.Tables.Clear()
da = New OleDb.OleDbDataAdapter("select * from auther", con)
da.Fill(ds, "ath")
DataGridView1.DataSource = ds.Tables("ath")
Catch ex As Exception
MsgBox("Exception Occured")
End Try
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Form2.Show()
End Sub
End Class
No comments:
Post a Comment
Note: only a member of this blog may post a comment.