Print -
Dataadapter with CommandBuilder - OLEDB
Imports System.Data.OleDb
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim connetionString As String
Dim connection As OleDbConnection
Dim oledbAdapter As OleDbDataAdapter
Dim oledbCmdBuilder As OleDbCommandBuilder
Dim ds As New DataSet
Dim i As Integer
Dim sql As String
connetionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Your mdb filename;"
connection = New OleDbConnection(connetionString)
sql = "select * from tblUsers"
Try
connection.Open()
oledbAdapter = New OleDbDataAdapter(sql, connection)
oledbCmdBuilder = New OleDbCommandBuilder(oledbAdapter)
oledbAdapter.Fill(ds)
For i = 0 To ds.Tables(0).Rows.Count - 1
ds.Tables(0).Rows(i).Item(2) = "neweamil@email.com"
Next
oledbAdapter.Update(ds.Tables(0))
connection.Close()
MsgBox("Email address updates !")
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
End Class