>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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only