Re: Need help with Informix and ADO
Posted in 1999
Letscho wrote: > Hi! > > I need to get an ODBC-Connection to an IDS (Informix CLI 2.5) via ADO. > According to some examples from the MSDN I tried the following code: > > Dim rst As New ADODB.Recordset > rst.Open "SELECT * FROM test", "DSN=somedsn;UID=max;PWD=anypwd;" > Do Until rst.EOF > Debug.Print rst("anyfield") > rst.MoveNext > Loop > rst.Close > > At execution I get the following error Message: > "Runtime Error 3706: ADO could not find the specified OLE DB Provider." > > The ODBC-source is installed correctly (I can access using DAO). Why does it > not work with ADO? > > Thanks, Letscho Hi Letscho, in your example you haven't provided the right OLE DB Provider. The way I connect through ADO and Informix CLI to a IDS by using the Microsoft OLE DB Provider for ODBC is the following: Dim sConnect as string ' Build first the connect string sConnect = "DSN=" & sDSN & ";" & _ "HOST=" & sHostName & ";" & _ "SERV=" & sService & ";" & _ "SRVR=" & sServer & ";" & _ "DB=test;PRO=olsoctcp;UID=testuser;PWD=testpasswort" ' Define a new ADO Connection Set ODBCConn = New ADODB.Connection With ODBCConn .ConnectionString = sConnect ' use the Microsoft OLE DB Provider for ODBC .Provider = "MSDASQL.1" .Open End With ' Now you can use the ODBCConn Objekt to open a recordset Dim rs As new ADODB.RecordSet rs.Open "SELECT * FROM test", ODBCConn, adOpenStatic, adLockOptimistic HTH Tolis Varnas -- V+K Relational Solutions mailto:tvarnas@compulink.gr Deligiorgi 26 mailto:tvarnas@orbit.de 546 42 Thessaloniki Voice: +30-31-820270 Greece Fax: +30-31-865463