You can try this routine by placing a command button named Command1 on a form, and pasting the routine into its Click event.
Run the program and click the button to connect and then disconnect.
Private Sub cmdTestConnection_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"
When the SAOLEDB provider is installed, it registers itself. This registration process includes making registry entries in
the COM section of the registry, so that ADO can locate the DLL when the SAOLEDB provider is called. If you change the location
of your DLL, you must re-register it.