Problem using OLEobject to access ADO 
Author Message
 Problem using OLEobject to access ADO

I'm trying to access ADO with RB 5.1 on a Windows 2000 system. Based
on on helpful hints from ReasSoftware, I obtained an example which I
unfortuneately have hit a dead end with.

I can sucessfully connect using the connection object, but all
attempts to use the recordset object fail with a "OLEException: Error
0 Type Mismatch". I've tried with 2 parameters (the minimum), 5
parameters, and passing the the ADO connection object and a connection

The primary difference I see is the calling sequence for the
connection objects expects a string, but the Open method on the
Recordset object expects variants. I can realbug this, but I'd like
second opinion on wheather I'm doing something wrong first.

  Dim adoConnection As OLEObject
  Dim adoRecordset As OLEObject
  Dim connectString As String
  Dim params(1) as Variant

  adoConnection = new OLEObject("ADODB.Connection")
  adoRecordset = new OLEObject("ADODB.Recordset")

  connectString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=D:\TCTC\race2000.mdb;Persist Security Info=False"

  params(1) = connectString
  adoConnection.Invoke("Open", params)

  // if equal to adStateOpen, then you're good to go
  if adoConnection.Property("State") = 1 then
    MsgBox "Connected!"
    MsgBox "Bummer"
  end if

  redim params(5)
  params(1) = "tblRaces"
  params(2) = connectString
  'params(2) = adoConnection
  adoRecordset.Invoke("Open", params)

  Do Until adoRecordset.Property("EOF").BooleanValue
    msgbox adoRecordset.Property("Name")

Exception err as OLEException
  msgbox err.message

Fri, 28 Oct 2005 20:47:44 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Problem of security using ADO from Labview to connect to Access 2000 Data Base

2. Problem : using ADO in ASP

3. Data select problem using ADO.

4. Problem using ADO in Python

5. Announce: - export from Access 2000 to MySQL via Microsoft Active Data Objects (ADO)

6. Using ADO in IIS

7. Using ADO in Python

8. Problems with access to serial port using reentrant code

9. Problem using Access with CW 2.0

10. Problem accessing the COM port using Causeway

11. Problems accessing file not used in templates.

12. ODBC / Access - Problems using C5 - Legacy


Powered by phpBB® Forum Software