Imports System.Data.OleDb
Public Class Form1
Dim pro As String
Dim connstring As String
Dim myconnection As OleDbConnection = New OleDbConnection
Dim command As String
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
pro = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\sinthu\Documents\Database1.accdb"
connstring = pro
myconnection.ConnectionString = connstring
myconnection.Open()
If myconnection.State = ConnectionState.Open Then
MsgBox("connected")
End If
command = "UPDATE[Table1]SET[JOBNO]='" & TextBox2.Text & "',[LABNO]='" & TextBox3.Text & "',WHERE[ID]='" & TextBox1.Text & "'"
Dim cmd As OleDbCommand = New OleDbCommand(command, myconnection)
Try
cmd.ExecuteNonQuery()
cmd.Dispose()
myconnection.Close()
TextBox2.Clear()
TextBox3.Clear()
Catch ex As Exception
MsgBox(ex.Message)
End Try
myconnection.Close()
End Sub
End Class