>I have been trying to research how to progmatically create a System DSN. When the application starts for the first time I would like to check to see if an ODBC data source exists, if not, I would like to create it for the user. It doesn't make sense to go to every PC into their control panel and create a DSN for every machine the app is installed on.
With VFP you can use a DSN-less connection to connect to ODBC. This way you don't need to "go to every PC into their control panel and create a DSN for every machine the app is installed on."
To create a DSN-less connection in VFP:
1. CREATE CONNECTION
2. Select "connection string" as the data
source and type something like (one continuous line):
DRIVER=sql server;
SERVER=your server name;
UID=your user id;
PWD=your password;
DATABASE=your remote database;
3. Try with verify connection.
No you can remove the "User DSN" connection from the ODBC panel.
There are many other ways to create a DSN-less connection. For example: You can create it on the fly so you don't need to store the userid/password in the database container. Take a look to SQLConnect().
Hector Correa