Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to specify ODBC connection in EXE?
Message
De
14/10/1998 15:28:24
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Divers
Thread ID:
00146099
Message ID:
00146828
Vues:
31
>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"
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform