You can try this routine by placing a command button named cmdUpdate on a form, and pasting the routine into its Click event.
Run the program and click the button to connect, display a message in the database server messages window, and then disconnect.
Private Sub cmdUpdate_Click( _
ByVal eventSender As System.Object, _
ByVal eventArgs As System.EventArgs) _
' Declare variables
Dim myConn As New ADODB.Connection
Dim myCommand As New ADODB.Command
Dim cAffected As Integer
On Error GoTo HandleError
' Establish the connection
myConn.Provider = "SAOLEDB"
myConn.ConnectionString = _
"Data Source=SQL Anywhere 12 Demo"
'Execute a command
myCommand.CommandText = _
"UPDATE Customers SET GivenName='Liz' WHERE ID=102"
myCommand.ActiveConnection = myConn
MsgBox(CStr(cAffected) & " rows affected.", _
After establishing a connection, the example code creates a Command object, sets its CommandText property to an update statement,
and sets its ActiveConnection property to the current connection. It then executes the update statement and displays the number
of rows affected by the update in a window.
In this example, the update is sent to the database and committed when it is executed.