View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
AA2e72E[_2_] AA2e72E[_2_] is offline
external usenet poster
 
Posts: 93
Default Try again: VBA to automatically install ODBC data source

DSN-less literally means that the connection string does not have the sub string "DSN=". Here is an example

Sub DSNless(
Cnn = "Provider=MSDASQL;Driver={Microsoft Access Driver (*.mdb)};DBQ=c:\nwind.mdb;
' Or you can use the one belo
' Cnn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\nwind.mdb;
Sql = "Select * From customers
Set ADORS = CreateObject("ADODB.RecordSet"
ADORS.Open Sql, Cn
End Su

A DSN-less connection may be quicker too: a DSN connection looks up the registry whereas a DSN-less connection does not

Database connections may be
based on a DSN,
DSN-less
based on a file DS
based on OLEDB,
based on UD

If you want to create a connection on your PC and distribute the method of connection to others, use a FILE DSN. Create one on your PC using the ODBC manager: this creates a file. You can distribute this file with your application. You can also choose the location of this file on target PCs as our connection can specify the full path of the File DSN

Search "File DSN" using Google for several examples.