How to establish odbc connection with DSN? 
Author Message
 How to establish odbc connection with DSN?

I can open an access database over a network with the following code.
How should I write the opendatabase line using a System DSN?
Also, does it matter what I write as the database name? I left "pubs" in

because I found it in the example code on MSDN.


    Dim confilepath As String
    Dim dbs As Database
    confilepath = "U:\mscirocc\Access\Products.mdb"
    Set dbs = OpenDatabase(confilepath, , False,
"odbc;database=pubs;pwd=barcode;uid=barcode;dsn=Product Database")
    Dim rs As Object
    Dim n As Long, x As Variant, y As Variant
    n = 0
    Set rs = dbs.OpenRecordset("select ID,description  from Products",
dbOpenDynaset, False)
    Do While Not rs.EOF
       ' read data into arrays
    Set rs = Nothing
    Set dbs = Nothing

Tue, 26 Feb 2002 03:00:00 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Crystal and ODBC DSN/DSN-less connections - do I need USER DSN or SYSTEM DSN

2. Import Excel with ODBC Drivers and DSN-less connection

3. Create ODBC connection without DSN

4. odbc fil dsn oracle 8i connection won't work

5. DSN for an ODBC connection

6. RDO Connection Error 40002 on ODBC DSN

7. DSN-less ODBC Connections (Oracle)

8. SQL Connection with a System DSN (ODBC)

9. DSN-less ODBC connection to SQL Server

10. Need DSN'less connection to Client Access ODBC Driver

11. ODBC Settings for an ADO DSN less connection

12. DSN-Less vs ODBC Connection


Powered by phpBB® Forum Software