Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Memo fields with carriage return line feed
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Divers
Thread ID:
01437288
Message ID:
01437301
Vues:
53
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.)  &&& make sure database is open and available

	Use (lcDatabase+'!' + lcTable) In 0 Again Shared
                     text to lcInsert textmerge noshow	
	   INSERT INTO <<lcTable>>  (<<lcFields>>)  VALUES  (<<lcValues>>)
	endtext
                     ?lcInsert && to test
	&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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform