Using an ODBC "auto"the following code ( two versions ) will not pull the data from the table.
If I create a "test.udl" I can connect and if I link the table through a test Access.mdb I can connect and pull the data.
But, both versions of code below error out as it tries to read into the table:
Code: Select all
Set Rst = New ADODB.Recordset
conn.Open "DSN=auto"
Rst.Open "SELECT UserID, VehID, JobID FROM DBA_MAN_PAR", conn
'MsgBox Rst.Fields(0)
'MsgBox Rst.Fields(1)
'MsgBox Rst.Fields(2)
While Not Rst.EOF
List1.AddItem Rst.Fields(1)
Rst.MoveNext
Wend
Rst.Close
conn.Close
Set Rst = Nothing
Set conn = Nothing
End Sub
Private Sub Command3_Click()
Dim conn As ADODB.Connection
Dim cmd As ADODB.Command
Dim rs As ADODB.Recordset
Dim connStr As String
Dim sqlText As String
Set conn = New ADODB.Connection
connStr = "DSN=auto"
conn.Open (connStr)
sqlText = "SELECT UserID, VehID, JobID FROM DBA_MAN_PAR"
Set cmd = New ADODB.Command
cmd.CommandText = sqlText
cmd.ActiveConnection = conn
Set rs = New ADODB.Recordset
Set rs = cmd.Execute()
rs.MoveFirst
Do While Not rs.EOF
MsgBox (rs.Fields(0).Value)
rs.MoveNext
Loop
End Sub
[Sybase][ODBC Driver][Adaptive Server Anywhere] Table or view not found: Table'DBA_MAN_PAR' Not found.
I'm stumped ???