Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Craig Moore
  Where is Craig Moore?
 
 United Kingdom
 Craig Moore
 To: Pete Sass
  Where is Pete Sass?
 Marathon, Ontario
 Canada
 Pete Sass
 Tags
Subject: RE: Connect in VFP Code to Access mdb?
Thread ID: 21774 Message ID: 21775 # Views: 21 # Ratings: 0
Version: Visual FoxPro 8 Category: ODBC, ADO and OLEDB
Date: Tuesday, April 01, 2003 4:29:04 PM         
   


can't you build up a string like

pcMdbLoc = 'D:\Scales\Chip_db.mdb'

lcConString = 'DSN=Chip_Scale;DBQ='+pcMdbLoc+';Driveld=281;FIL=MS Access;Max Buffer Size=2048 Page Timeout=5;PWD=thepassword;uid=admin;'

STORE SQLSTRINGCONNECT(&lcConString) TO gnConnHandle

= SQLDISCONNECT(gnConnHandle)

or something like this, is this what you are after or am I way of track?

Craig





> Hi,
> Building an application and started using code to setup the connection and
> with code add the remote view tables.
>
> Example of connection code:
>
> * --- DATACONN.PRG - To programically connect to a backend database
> * --- Peter Sass, 2003.03.06
> * --- Have to open the database first
> CLOSE DATABASES ALL
> OPEN DATABASE SCALES SHARED
>
> * --- Now Create the connection
> CREATE CONNECTION Chipconn DATASOURCE "Chip_Scale" USERID "Admin" PASSWORD "thepassword"
>
> * --- Set the ODBC Login prompt to never prompt you
> DBSetProp('chipconn','Connection','DispLogin', 3)
>
>
> What I want to do is use a connection string in code and the connection string for
> this actual connection is :
> DSN=Chip_Scale;DBQ=D:\Scales\Chip_db.mdb;Driveld=281;FIL=MS Access;Max Buffer Size=2048;
> Page Timeout=5;PWD=thepassword;uid=admin;
>
> What I am trying to do is use the string to connect so I can somehow get into the
> "DBQ=D:\Scales\Chip_db.mdb" portion of the string and treat this part as a memory
> variable that I can change. So if the Access database location moves to a different
> location on the server, a global setup module change change a memory variable
> holding the DBQ path will wash into the connection string and change it there.
>
> Any ideas out there ??????? or examples of connection string code using a
> memory variable within the string that can be changed ???????
>
>
> Pete from the Great White North. (Only in Canada, ay.) Over and Out ...


COMPLETE THREAD

Connect in VFP Code to Access mdb? Posted by Pete Sass @ 4/1/2003 3:39:20 PM
RE: Connect in VFP Code to Access mdb? Posted by Craig Moore @ 4/1/2003 4:29:04 PM
Connect in VFP Code to Access mdb "Close" Posted by Pete Sass @ 4/1/2003 6:03:02 PM
RE: Connect in VFP Code to Access mdb "Got it !" Posted by Pete Sass @ 4/1/2003 7:54:37 PM