This article describes how to use a DSN-less connection that connects to an InterBase database from Visual Basic or VBA by using the Easysoft InterBase ODBC driver.
Connection
object:
Dim con As New ADODB.Connection
Open
method to connect to the database. For example:
con.Open "Driver={Easysoft Interbase ODBC};" _ & "Database=myinterbaseserver:c:\myinterbasedatabase.gdb;" _ & "UID=myinterbaseusername;PWD=myinterbaseusername"
For more information about the InterBase ODBC driver attributes that you can specify in the Open
method's ConnectionString
argument, refer to the InterBase ODBC driver documentation.
Recordset
object. The following code fetches some data and displays the results in the Immediate window:
Dim rs As New ADODB.Recordset rs.Open "select column from mytable", con Do Until rs.EOF Debug.Print rs.Fields(0) rs.MoveNext Loop
rs.Close con.Close
Note When you close a connection in ADO, the connection only closes in your program. ADO keeps the connection alive in case you connect again.