Dataadapter UpdateCommand - OLEDB Data Source

OleDbDataAdapter is an essential component of the ADO.NET Data Provider. It plays a crucial role in updating a Data Source with data modifications performed on a DataSet object. The OleDbDataAdapter achieves this through its InsertCommand, UpdateCommand, and DeleteCommand properties, specifically designed to handle database updates.

To illustrate the usage of the OleDbDataAdapter object and its UpdateCommand properties for updating an OLEDB Data Source, consider the following code samples:

Full Source VB.NET
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 New OleDbDataAdapter Dim sql As String connetionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Your mdb filename;" connection = New OleDbConnection(connetionString) sql = "update Users set Password = 'new password' where UserID = 'user1'" Try connection.Open() oledbAdapter.UpdateCommand = connection.CreateCommand oledbAdapter.UpdateCommand.CommandText = sql oledbAdapter.UpdateCommand.ExecuteNonQuery() MsgBox("Row(s) Updated !! ") Catch ex As Exception MsgBox(ex.ToString) End Try End Sub End Class

Make sure to replace "YourConnectionString", "YourTable", and the column names in the update query with your specific values.