Public Class Form5
Dim connection As OleDb.OleDbConnection
Dim mystr As String
Dim cmd As OleDb.OleDbCommand
Dim adp As OleDb.OleDbDataAdapter
Dim ds As New DataSet
Private Sub Form5_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs)
connection.Close()
End Sub
Private Sub Form5_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
mystr = ("Provider=Microsoft.JET.OLEDB.4.0;" & _
"Data Source=C:/Users/Space Era/Documents/mod.mdb")
connection = New OleDb.OleDbConnection(mystr)
' Fill the data grid viewer
connection.Open()
cmd = New OleDb.OleDbCommand("SELECT modify.[Server Name], modify.[Backup taken by], modify.[Action taken by] FROM modify", connection)
adp = New OleDb.OleDbDataAdapter(cmd)
adp.Fill(ds, "modify")
Me.DataGridView1.DataSource = ds
Me.DataGridView1.DataMember = "modify"
End Sub
Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim cmdbuilder As New OleDb.OleDbCommandBuilder(adp)
Try
adp.Update(ds, "modify")
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
End Class
Output - Syntax error in insert into statement......any suggestions..!!