Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Adding a DSN programatically
Message
 
 
To
14/03/2002 15:42:09
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00633020
Message ID:
00633174
Views:
22
There's ODBC DSN Class file #9749 in the download section that does it.

>Following an article found on UT, I have tried the following code to add a FoxPro free table dsn. It returns 0, but I don't see the dsn in the ODBC connections in Control Panel. Can anyone help me out? Thanks kindly.
>
>#define ODBC_ADD_DSN 1
>#define ODBC_CONFIG_DSN 2
>#define ODBC_REMOVE_DSN 3
>#define ODBC_ADD_SYS_DSN 4
>#define ODBC_CONFIG_SYS_DSN 5
>#define ODBC_REMOVE_SYS_DSN 6
>#define ODBC_REMOVE_DEFAULT_DSN 7
>
>
>#define SQL_NO_DATA 100
>#define SQL_SUCCESS_WITH_INFO 1
>#define SQL_SUCCESS 0
>#define SQL_ERROR -1
>
>DECLARE Integer SQLConfigDataSource IN odbccp32.dll Integer, Short, String @, String @
>
>lc_dsn="dsn=testdsn"+ CHR(0) + ;
>"DRIVER=Microsoft Visual FoxPro Driver (*.dbf)"+ CHR(0) + ;
>"UID="+ CHR(0) + ;
>"Deleted=Yes"+ CHR(0) + ;
>"Null=Yes"+ CHR(0) + ;
>"Collate=Machine"+ CHR(0) + ;
>"BackgroundFetch=Yes"+ CHR(0) + ;
>"Exclusive=No"+ CHR(0) + ;
>"SourceType=DBF"+ CHR(0) + ;
>"SourceDB=c:\SSPDF"+ CHR(0)
>
>fResult = SQLConfigDataSource(0, ODBC_ADD_DSN, @lc_driver, @lc_dsn)
>
>? fresult
>
>Gerry Lamb
>Newkirk Products, Inc.
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform