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!

Problems accessing csv file through ODBC

Status
Not open for further replies.

kylefield

Technical User
Nov 10, 2005
7
US
I am trying to access a simple csv text file through the standard ODBC driver. I have done it many times.

This time however, VFP seems to think all the fields are MEMO fields for some reason.

Can anyone help me with this?
 

I suspect the reason is that the fields in the first row are wider than 254 chars, so the driver makes the fields in the first row into memos, and all the other fields follow suit.

But do you have any special reason for doing this? It would be much easier to APPEND FROM or IMPORT the CSV file into a table or cursor.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
Yes, I thought of that...

Tell me this - will I be able to modify a record (in the text file) by going through ODBC? This is really what I need to do.

Thanks Mike, you are always a big help.
 
Low level file functions would be much faster. I usually read an input file and output a modified file. If you want to replace the original after it'd be the same as modifying.

Take a look at my FAQ Transform a Partially Formatted Delimited Text File Into a Standard Delimited File faq184-4275 and modify as you see fit.

Brian
 

Kylefield,

will I be able to modify a record (in the text file) by going through ODBC?

I don't think so. I believe the driver will treat it as read-only (but I'm not completely sure).

Again, I think it would be easier to import it into a table, modify it there, and write it out to a text file again. Or, bring the whole file into a string (using FILETOSTR()), then use VFP's string-handling functions to make your changes, then write it out again.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top