Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using UPDATE for Memo field
Message
 
 
À
08/08/2004 04:52:23
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00931478
Message ID:
00931652
Vues:
19
>
>"fields list length is fixed." : the number of fields into the INSERT is constant,
>that is it is always the same number.
>
>
>For example. Say the table RR_RESER has two fields NUM_FLD N(10), and CHAR_FLD C(100). Then I am trying to insert values 100, "My String". I think the value of cFieldName would be:
>
>cFieldName = "NUM_FLD, CHAR_FLD"
>
>But I can't figure out how to combine values 100 and "My String" into the variable m.cFieldValues.
>
>What am I missing? Thank you.
>

>
>You cannot use single a variable for combine two or more fields, every variable it indicates a single field whose name can change.
>
>
>INSERT INTO (m.tablename) (m.cFieldName1,m.cFieldName2...)
>
>
>Of course, if the number of fields can change, you have to use a Macro or another way.
>
>If you use variables with name equal to field Name, then:
>
>cFieldNames = "NUM_FLD, CHAR_FLD"
>cFieldValues = "m.NUM_FLD, m.CHAR_FLD"
>insertcommand="INSERT INTO "+m.TableName+" ("+m.cFieldNames+")VALUES("+m.FieldValues+")"
>
>
>But this is equal to :
>
>INSERT INTO (m.TableName) FROM MEMVAR
>
>
>An other simple solution is that one to use an object with the values puttinges in its property with the name of the property equal to the name of every corresponding field,
>then the INSERT is a direct command:
>
>INSERT INTO (m.TableName) FROM NAME m.oFieldValuesToInsert
>
Thank you for taking the time to give me a detailed answer. In my case the number of fields to be updated is not fixed, and one of the fields can have the "bad" characters (chr(10),chr13) which VFP does not allow in macro. Therefore, I decide to change the approach and update the table using REPLACE. This way I am not hitting the problem with chr(10), chr(13) and I can do it with variable number of fields.

Again, thank you for your help.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform