Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Memo fields with carriage return line feed
Message
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Memo fields with carriage return line feed
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01437288
Message ID:
01437288
Views:
140
i have a simple method to insert records into any table and any database depending on parameters passed.


LPARAMETERS lcDatabase, lcTable, lcFields, lcValues

lnReturn = 0
Use In Select(lcTable)

If This.m_open_database(lcDatabase,.F.) &&& make sure database is open and available

Use &lcDatabase!&lcTable In 0 Again Shared

INSERT INTO &lcTable ;
(&lcFields);
VALUES ;
(&lcValues)


lnReturn = &lcTable..pk



ENDIF

Use In Select(lcTable)
This.m_close_database(.F.)


RETURN lnReturn



and works find except when i have a memo field and the value contains a carriage return line feed.

if the memo field is 'note' and the value to to insert is

lcNote = 'Some text line 1'+chr(10)+chr(13)+'second line'
and i do a insert like


Insert into cTable (fk_category, note) values (715, lcNote)


this works fine

However in the method above i would pass in the parameters

lcDatabaseName ' SomeDatabase'
lcTable = 'cTable'
lcFields= 'fk_category,Note'
lcValues = alltrim(str(715))+','+lcNote

the method will fail. if the lcNote does not contain the carriage return - line feed everything is okay.


what am i missing?

Thanks in advance
Next
Reply
Map
View

Click here to load this message in the networking platform