Discussion Locked

Visual Basic: Connect to a teradata database from VB

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

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.

thanks
laura

2 replies

by tony hopkinson

database.open (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.

by jwpierce1830

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.

This discussion is closed to new replies.