Click to See Complete Forum and Search --> : Creating a DSN file at run-time.


ba_sagar
August 31st, 2001, 06:30 AM
I had to create a DSN to create a linked table in Access from SQLServer...AT RUN-TIME.

I found out from MSDN articles that it can be done by API calls..but guess what I did ?

I did it like this..

Open App.Path & "\thedsn.dsn" For Output As #13
Print #13, "[ODBC]"
Print #13, "DRIVER=SQL Server"
Print #13, "UID = sa;"
Print #13, "Database = Goldmine"
Print #13, "SERVER=(local)"
Print #13, "Description=Connection to Goldmine database"
Close #13

..and this works.

I want to know

"is this acceptable ?"
"is this the best method to create a DSN at run-time ?"
"are there any implications invilved in this ?"

Please comment..

Thanks in advance
Anand Sagar
ba_sagar@yahoo.com

A Hitchins
August 31st, 2001, 06:38 AM
I had to do this but i made a DSN in the registry. Look in HKEY_LOCAL_MACHINE\Software\ODBC for guidence, you should be albe to pick up whats needed then create a folder and the keys to make your DSN. I have some code if you want it. gobiejobler@hotmail.com