|
Question : ADO ODBC to Centura SQL DB
|
|
We have an Access DB and we are trying to connect to a table in a centura SQL db. We are trying to qualify the import by selection criteria. It is failing on the connection Open command - Error: " ODBC call failed"
The code is listed below:
Public Function GetData()
Dim rst As ADODB.Recordset Dim con As ADODB.Connection Dim param As ADODB.Parameter Dim com As ADODB.Command Dim WS As Workspace 'Open connection Set con = New ADODB.Connection con.ConnectionString = "ODBC;DSN=PCPAYWIN;DB=PAY4WIN;UID=RRR;PWD=PW" con.Provider = "Microsoft.Jet.OLEDB.4.0" If WS Is Nothing Then Set WS = CreateWorkspace("RESNAV WORKSPACE", "ResNav", "ResNav", dbUseODBC) 'Set con = WS.OpenConnection("RESNAV CONNECTION", , , con) End If con.Open con.ConnectionString
'Create and manipulate command object Set com = New ADODB.Command com.ActiveConnection = con com.CommandText = "SELECT * FROM REPORTS_V_EMPLOYEE"
Set rst = New ADODB.Recordset rst.Open com, , adOpenKeyset MsgBox rst.Fields(0).Value End Function
|
|
Answer : ADO ODBC to Centura SQL DB
|
|
You need to find the Centura equivalent to the two lines
con.ConnectionString = "ODBC;DSN=PCPAYWIN;DB=PAY4WIN;UID=RRR;PWD=PW" con.Provider = "Microsoft.Jet.OLEDB.4.0"
The rest of your code *should* work fine.
|
|
|
|