Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Create Connection / SQLConnect
Message
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Create Connection / SQLConnect
Miscellaneous
Thread ID:
00161962
Message ID:
00161962
Views:
60
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
Next
Reply
Map
View

Click here to load this message in the networking platform