Dataadapter UpdateCommand - OLEDB Data Source

OleDbDataAdapter is a part of the ADO.NET Data Provider. The InsertCommand, the UpdateCommand, and the DeleteCommand properties of the OleDbDataAdapter object update the Data Source with the data modifications that are run on a DataSet object.

The following code samples that demonstrate how to use the OleDbDataAdapter object to update an OLEDB Data Source using UpdateCommand properties in OleDbDataAdapter.

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'"
            oledbAdapter.UpdateCommand = connection.CreateCommand
            oledbAdapter.UpdateCommand.CommandText = sql
            MsgBox("Row(s) Updated !! ")
        Catch ex As Exception
        End Try
    End Sub
End Class (C) 2021    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.
SiteMap  | Terms  | About