Connection strings are one of the
least-understood concepts, in part due to the fact that each provider (Access,
SQL Server, ODBC etc.) usually has its own set of
arguments that must be passed.
Fortunately, the Microsoft Data Link can quickly build & test connection strings. You can refer to the Data Link (extension UDL) or you can open the UDL with NotePad and simply copy the connection string to use in your application.
To begin, right-click on your desktop and select New => Text Document. Change the extension from TXT to UDL (tell Windows it's ok to change the extension) and then double-click the file to bring up the Data Link menu. There are two basic methods to build your string:
Select "Use data source name" and click the drop-down list to select an existing DSN. Alternatively, you can select "Use connection string" and then click the Build button. When I point the UDL to my existing SQL Server connection, and open it with NotePad, the UDL file contains this:
; Everything after this line is an OLE DB initstring
Provider=MSDASQL.1;Persist Security Info=False;Data Source=Application1
When you are satisfied, click Test Connection to verify that it works; click OK.