You're using too many & (macros) unnecessary. See changes inside your code:
>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.)
Use (lcDatabase+'!' + lcTable) In 0 Again Shared
text to lcInsert textmerge noshow
INSERT INTO <<lcTable>> (<<lcFields>>) VALUES (<<lcValues>>)
endtext
?lcInsert
&lcInsert
lnReturn = evalute(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
If it's not broken, fix it until it is.
My Blog