Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to specify ODBC connection in EXE?
Message
From
14/10/1998 15:28:24
 
 
To
13/10/1998 00:02:17
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00146099
Message ID:
00146828
Views:
30
>My VFP 6.0 app reads SQL tables from an accounting package written by another vendor. On my development machine, it is very easy to establish the ODBC connection because I know the name of my server and the database I want to access. However, when I distribute my EXE, the user will have to specify the name of their own server and database. I'm looking for the most user-friendly solution to establish the user's connection. Should I include VFP's connection designer in the EXE or has anyone already written a better user interface to specify connection properties?

In addition of the routine to read the data sources defined in the system posted by Bob Lucas, you can use this other API call to create a DSN:
Procedure AddDSN
Lparameters driver, dsn, defaultDB
Local SuccFail
  DECLARE Integer SQLConfigDataSource In odbccp32.dll ;
    Integer, Integer, String, String
  Settings="DSN="+AllTrim(dsn)+Chr(0)+;
           "Description="+AllTrim(dsn)+Chr(0)+;
           "Server="+Alltrim(driver)+Chr(0)+;
           "Database="+AllTrim(defaultDB)+Chr(0)

  SuccFail = SQLConfigDataSource(0,1,driver,Settings)
And for SQL server:
Do AddDSN With "SQL Server", "MyDSN", "MyDB"
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform