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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Foxpro 2.6 Question 1

Status
Not open for further replies.

porto99

Technical User
Nov 1, 2004
96
GB
I know this may not be the correct forum, but the only one I could find.

I need to import a old Foxpro database into my own designed database. I will write the software to import a Tabbed delimited text files (Exported from Foxpro). However how do I get the memo files into this tabbed file. I have long forgot.

Porto.

 
Hi Geoff, No will be writing the import to my database in c/c++.

The export from Foxpro is via the command window; e.g. Copy To ..

Its just how to export the menu fields also from the Foxpro database into a CSV file.

 
Fox's COPY TO command can only copy the fixed width fields to a csv because a memo field can contain things like carriage returns - worse still, a memo field might even contain binary data.

Fox accepts SQL in programs or in the Command Window. You could try using SQL to convert the memo fields into long text fields. A command like:
Code:
SELECT ..., LEFT(memoField, 254) As ShortMemo ... INTO CURSOR csrTemp
would truncate all the memo fields into CHAR(254) and might be acceptable. Then you just do a COPY TO ... TYPE CSV from the cursor.

Another option in Fox 2.6 is to use the TEXTMERGE() function to generate a text file which includes the text of the memo fields. Get rid of the line feeds by using the CHRTRAN() function to translate all the CHR(13) and CHR(10) characters in the memo into spaces. I've got some sample code at
If you're using an up-to-date version of Fox then the CursorToXML function might help. This will export memo fields to an XML file and you could then parse that in C. Fox 2.6 though is ten years old and I don't remember XML being around back then.

Geoff Franklin
 
Thanks Geoff, just had a though - well two.

1. Is CHAR(254) the maximum or can I do CHAR(2048).

2. Would MS Acess be able to import the Foxpro database, memo fileds included?

Then just a case to saving the MS Acess database as a CSV file.

Any comments?
 
The only Access version I found to be dealing great with FoxPro 2.6 memo fields was 97.
Link (or import) the dbf files and then handle them just as normal Access memo fields.

With later versions of Access I just couldn't do anything with such memo fields (Table isn't in the expected format)

HTH


[pipe]
Daniel Vlas
Systems Consultant

 
Geoff, thanks for your post.

I am still having problems.

Some Memo fields are over 400 charaters long with a few cr/lf's present.

I think I just need to get rid of them as I can seem to be able to import the FoxPro database into MS Access 2003 database OK apart from some of the missing lines from the Memo fields with cr/lf present.

I did look at the TEXTMERGE() but don't know how to use it with FoxPro - only used FoxPro a little bit 10 years ago.

Regards,

Porto.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top