Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open a dbase dbf in fox via ADO

Status
Not open for further replies.

SBTBILL

Programmer
May 1, 2000
515
US
I'm looking for info on how to write the connection string to open a dbase type file in fox without converting the memo fields. My thought is that ADO would do it, but I gan't figure out the connection string.

I need to do the same thing with Peachtree btrrieve files.

Anybody done this?

Bill Couture
 

Bill,

You should be able to do it via plain ODBC. Just create a DSN in the ODBC control panel applet, then hook into it in VFP via SQLCONNECT(). That way, you'll be able to query the dBase fields (minus the memos) into a VFP cursor, without the hassles of ADO.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
Glanced through the MS document. Maybe I'm missing something but it seems to deal primarily with ADO and SQl server. I'm not interested in SQL server at this point. I use ADO to connect to that already.

The first thing I'm tring to find out is how can I use ADO to connect to a Cougar Mountain Accounting table which is in DBASE format and can not be converted to Fox format.

The second is how to connect to a Peachtree btreieve file. Again using ADO. I can do it with DDE but that isn't real efficient.

This get to be very frustrating as in the first case I can use ACCESS or VB but prefer Fox.

Bill Couture
 

Bill,

ADO is ADO. You use it with dbase files just as you would with any other "back end" -- you just need to make sure you have the right OLE DB provider.

Do you need to connect to, and update, live files -- or do you only need to read the data? If the latter, can you get away with taking a snapshot. You can copy dBase files to Foxpro tables, minus the memo fields -- just use the normal COPY TO command.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
use odbc for data or a shared acces for the tables.

coco10
 
lcconnstr="DRIVER={SQLSERVER};SERVER=godzilla;UID=SA;PWD=rodan#$"
databaseoconnection=CREATEOBJECT("ADODB.Connection")
oconnection.OPEN(lcconnstr)
c1=oconnection.execute(grabcan)
What I'm trying to figure out is what be the connection string, i.E. the first line for dbase or Betrieve.

Bill Couture
 
Bill,

Something like this:

Code:
DRIVER=Microsoft dBase Driver (*.dbf);UID=admin;FIL=dBase IV;DriverId=277;DBQ=C:\data

The way to figure these out is to go the ODBC applet in Control Panel, set up a new File DSN interactively, then open the DSN file (it's a plain text file) and read the settings.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
Thanks Mike,

Figured it out when I put an underscore in front of DBQ. Found I didn't need either UID, FIL, or DriverID settings to open the CMS (Cougar Mountain) tables. As I understaqnd it DBQ is just a variable to hold the path. Anyhow, found I could substitute _fat or _cfile for it and the connection still worked.

Thanks again,
Bill Couture
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top