Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to copy text file line by line to memo field?
Message
 
To
10/07/2006 04:19:19
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01134853
Message ID:
01134860
Views:
19
This message has been marked as a message which has helped to the initial question of the thread.
>Hi all,
>
>I have text files with lines of data and I wanted to copy them line by line to a memo field of a table, 1st line go to 1st record, 2nd line go to 2nd record. I have tried the following codes but somehow when the length of the line exceeds 50, it will append the following characters into 2nd record. Any idea?
>
>
>
>CREATE CURSOR lctest (mdata m)
>nline = MEMLINES(FILETOSTR(TRANSFORM(lcfile))) && lcfile = file name
>	
>FOR i=1 TO nline
>   INSERT INTO lctest VALUES (MLINE(FILETOSTR(TRANSFORM(lcfile)),i))
>ENDFOR
>
>
Youi could use ALINES() also
DEFINE CRLF CHR(13)+CHR(10)
LOCAL lcFile, lnFor, laLines, lnLines
CREATE CURSOR lctest (mdata m)
lcFile = FILETOSTR(TRANSFORM(lcfile))
lnLines = ALINES(laLines,lcFile, 0, CRLF)
	
FOR i=1 TO lnLines 
    INSERT INTO lctest VALUES (laLines[i])
ENDFOR
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform