Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Create Connection / SQLConnect
Message
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Create Connection / SQLConnect
Divers
Thread ID:
00161962
Message ID:
00161962
Vues:
61
Using VFP 6.0 / Win 95.

This is my first attempt at ODBC and I'm trying to programatically make a connection to an Access database after having gotten the database name and path from the user.

Everything either <seems> to go smoothly but then the SQLConnect command will not make a connection or else the Create Connection command will cause the Connection Designer to pop-up which I don't want the user to have to see.

Here is one of my many attempts that looks like it should work but it doesn't.

  OPEN DATABASE c:\MyDirectory\MyDB.dbc EXCLUSIVE

  lcConnString = 'DSN=My Access 7.0;'
  lcConnString = lcConnString + 'DBQ=C:\MyDirectory\MyAccess.mdb;'
  lcConnString = lcConnString + 'DefaultDir=C:\MyDirectory;'
  lcConnString = lcConnString + 'Driver={Microsoft Access Driver (*.mdb)};'
  lcConnString = lcConnString + 'DriverId=25;'  && Access
  lcConnString = lcConnString + 'FIL=MS Access;'
  lcConnString = lcConnString + 'UID=admin'

  CREATE CONNECTION AccessTst1 CONNSTRING lcConnString

  gnConnHand=SQLCONNECT('AccessTst1')


Can anybody tell me what's missing here?  The example above will still ask the user for the Data Sourse Name and database to connect to even though they are listed in the Connection String.

Any Help would be appreciated.

TIA

Ed
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform