Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ODBC connection?
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00713618
Message ID:
00713645
Views:
20
You may use SQLConfigDataSource to Add, Delete and Modify ODBC Data Source Name (DSN) entries on a local computer. If a DSN already exists and you call SQLConfigDataSource to add a new DSN, the old DSN will be overwritten.
DECLARE Integer SQLConfigDataSource IN odbccp32.dll Integer, Short, String @, String @

*&  ===========================================
*&	The function takes 4 parameters; 
*&	1. A handle to a window (hwnd)

*&	2. Configuration type (add, delete, or modify) (user or system)
*&	#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

*&	3. Database Driver Name
*&	4. Connection Parameter Information string. 

*&	All String Parameters should be terminated with a CHR(0).The Connection Parameter info string (parameter #4) should be a delimeted list of parameters and values. The delimeter is CHR(0). See examples.

*&	The SQLConfigureDataSource API function returns an Integer value. The return value can be one of the following:

*&	#define SQL_NO_DATA 100
*&	#define SQL_SUCCESS_WITH_INFO 1
*&	#define SQL_SUCCESS 0
*&	#define SQL_ERROR -1

*&	If SQLConfigDataSource returns 1 or -1 you can use the SQLInstallerError API function to get error information.
*&  ===========================================

*&  Example
lc_driver = "SQL Server" + CHR(0)
lc_dsn = "dsn=testdsn" + CHR(0) + ;
         "server=127.0.0.1" + CHR(0) + ;
         "database=bigdb" + CHR(0) + ;
         "network=DBMSSOCN" + CHR(0)  && DBMSSOCN = TCP/IP connection

fResult = SQLConfigDataSource(0, ODBC_ADD_DSN, @lc_driver, @lc_dsn)

IF fResult = -1 OR fResult = 1
    * Call the SQLInstallerError API for error Information.
ENDIF
HTH


>how can i test if a ODBC connection already exist in a computer?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform