This tutorial will instruct you on how to create a simple DSN connection to an Access database, but the same concepts apply for connecting to any other database through a DSN connection....
This article demonstrates how to programmatically create a Data Source Name (DSN) for SQL Server using Visual Basic. The technique discussed in this article uses Windows Application Programming Interface (API) functions to create and manipulate entries in the Windows Registry.