Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
What could cause error on this line
Message
 
 
To
11/10/2011 15:40:01
James Blackburn
Qualty Design Systems, Inc.
Kuna, Idaho, United States
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01526039
Message ID:
01526079
Views:
47
Thank you for your help. I will see if this apply too. So far, what Naomi suggested should work. Don't take it personally; I am looking for just one solution; and then I am off to putting out another fire <g>. I am sure you understand me.


>Unless I am missing something, this shouldn't be that hard. How does this look
>
>SCAN 
>lcTable = DataDict.TableName
>select DataDict 
>
>lcFields = "INSERT INTO "+lcTable+" ("
>lcValues = "Values("
>lcComma = ''
>* seems to me that this should be scan for
>   scan while  TableName = m.lcTable
>    lcFields = lcFields + lcComma + CRLF + alltrim(FieldName)
>    lcValues = lcValues + lcComma + CRLF + '?poRow.' + alltrim(FieldName)
>    lcComma = ', '
>   ENDSCAN
>   lcInser = lcFields + ') '+CRLF + lcValues +')'
>   PRIVATE poRow 
>   * shouldn't there be a select data tabel here?
>   SCAN FOR tablename = m.lcTable && not sure what condition this should be
>    	SCATTER NAME poRow 
>      sqlexec(hCon, m.lcInser)
>      ENDSCAN
>     endtext
>   lcTable = DataDict.tableName
>endscan
>
>
>>>>I agree with everything you are saying. And just for the heck of it (even though VFP does not recommend) I will try to use TEXTMERGE within TEXTMERGE just to see what comes out. Stay tuned.
>>>
>>>It is actually quite simple after I thought about it.
>>>
>>>To generate Insert command:
>>>
>>>
>>> lcTable = DataDict.TableName
>>>
>>>select DataDict 
>>>
>>>   scan while  TableName = m.lcTable
>>>    lcFields = lcFields + IIF(empty(m.lcFields,'') + ', ' + CRLF + alltrim(FieldName)
>>>    lcValues = lcValues + IIF(empty(m.lcValues,'') + ', ' + CRLF + '?' + m.lcTable + '. ' + alltrim(FieldName)
>>>   endscan
>>>   text to lcPRG additive textmerge noshow
>>>           text to lcInsert noshow
>>>          INSERT INTO <<m.lcTable>> (
>>>                    <<m.lcFields>>
>>>                   )
>>>             VALUES (
>>>                 <<m.lcValues>>
>>>            )
>>>        endtext
>>>       SCAN <<m.lcTable>>
>>>
>>>           sqlexec(hCon, m.lcInser)
>>>      ENDSCAN
>>>     endtext
>>>   lcTable = DataDict.tableName
>>>endscan
>>>
>>>The above is the idea from the top of my head, you may need just some slight changes.
>>
>>No, this will not work. Nexted TEXT TEXTMERGE do not work. What happens is that after the TEXT MERGE for lcInsert, the line SCAN m.lcTable (with brackets) gets error.
"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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform