Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Progmatically Creating ODBC datasource
Message
From
02/07/1999 10:20:55
 
 
To
01/07/1999 23:10:14
Denis Poulin
Ari Finacial Services Inc.
Mississauga, Ontario, Canada
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00236796
Message ID:
00236908
Views:
19
>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.
You can do it with SQLConfigDataSource API call (This example is for SQL Server driver):

DECLARE Integer SQLConfigDataSource In odbccp32.dll ;
Integer, Integer, String, String
Settings="DSN=myDSN"+Chr(0)+;
"Description=myDescription"+Chr(0)+;
"Server=mySQLServer"+Chr(0)+;
"Database=mySQLDatabase"+Chr(0)

SuccFail = SQLConfigDataSource(0,1,"SQL Server",Settings)

I know there's one that lists the available DSNs, but I don't have it handy.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform