If you are using ADO use the following code snippet to connect, then
retrieve data from an ODBC source:
Dim rsObject As Recordset
Dim sConnection As String
sConnection = "User ID=uid;Password=pass;Data Source=test"
sSQL = "Select * from pubs"
Set rsObject = New Recordset
rsObject.Open sSQL, sConnection
With rsObject
Do While Not .EOF
sText = .Fields("ID")
sText = sText & ";" & .Fields("Name") ' The field names are
in ""
lstList.AddItem sText ' This adds a line to a list box
.MoveNext
Loop
.Close
End With
Set rsObject = Nothing
--
Remove the "x" from the end of the email address to respond
> Howdy All!
> I am just trying to learn ODBC connectivity. I really would like to
> connect to a pre-established System DSN on the machine to pull the data
> into my VB Application. Can anyone just point me in the right direction
> on even accessing the database via the DSN? Even a website with some
> reference material would be great!
> Thanks in advance!
> Sent via Deja.com http://www.deja.com/
> Before you buy.