General discussion


Visual Basic: Connect to a teradata database from VB

By 472955 ·
Hi all!!!
I am quite new in Visual-Basic and i am trying to establish a connection with a Database Teradata (using an ODBC connection), my code es the following:
Dim qdfTemp As QueryDef
Dim rstTemp As Recordset
Dim dbs_cls_tbug As Database

Set dbs_cls_tbug = OpenDatabase("dwht1", False, False, "ODBC;DSN=dwht1;PWD=ex0n3")

Set qdfTemp = dbs_cls_tbug.CreateQueryDef("")
qdfTemp.sql = "select * from inc_sas_tbug"

qdfTemp.ReturnsRecords = True

With qdfTemp

'open recordset from queryDef
Set rstTemp = .OpenRecordset()

With rstTemp
End With

End With
when the execution tries to execute the line:
Set rstTemp = .OpenRecordset(), i receive an exception with no number...
i am trying to do it since almost two weeks and i don't know what else i can try
but i think the problem is on the connection although the exception is when i open the recordset
if someone could help me, i would be very happy.


This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -


by Tony Hopkinson In reply to Visual Basic: Connect to ... (connect ?)
first then .
see if you can external link in with excel or access thriugh the dsn and execute the query.
Not familiar with teradata, but presumably it has a log somewhere may there's a less opaque error description in it.
Also make sure the ODBC driver yiou have for teradata is the correct one.

Also hit google with vb teradata and teh exception text, we are never usually the first to find a bug.

Collapse -

ODBC Drivers and Connection

by jwpierce1830 In reply to Visual Basic: Connect to ...

The ODBC drivers I have used have an option to test the connection in them. If that works then look at your code. I don't see anything in you code defining or establishing a connection.

Related Discussions

Related Forums