ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Changing DSN programmatically? (https://www.excelbanter.com/excel-programming/314161-changing-dsn-programmatically.html)

Michael Bourgon

Changing DSN programmatically?
 
I have a bunch of XL spreadsheets that all query the same DSN, a
FoxPro database. I want to move them to our SQL Server copy of those
databases. They have two DSNs on their machine, "VFP" for the Visual
Foxpro, and "SQL" for the SQL Server.

Is there any way to automatically update the DSN? Currently, it looks
like I'd have to rebuild the entire query from scratch, and I'd rather
avoid that. I've built views in a database that are called the same
thing. However, I might need to tell it which database to use, since
in VFP we'd query "mike", whereas in SQL we'd have to query
"main.dbo.mike".

Thanks in advance.

Jamie Collins

Changing DSN programmatically?
 
(Michael Bourgon) wrote ...

I have a bunch of XL spreadsheets that all query the same DSN, a
FoxPro database. I want to move them to our SQL Server copy of those
databases.
Is there any way to automatically update the DSN?


I think you'd need to use the odbc API to do this. See:

http://msdn.microsoft.com/library/de...itefiledsn.asp

Jamie.

--


All times are GMT +1. The time now is 04:22 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com