Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
UPDATE - SQL using Form Control Values
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows Server 2003
Miscellaneous
Thread ID:
01264672
Message ID:
01264851
Views:
11
Have you complimented it recently? Told it you love it? Taken it out for dinner or said how great its @ss looks in those pants? No!? Well then, what can you expect! <g>

>I guess the UT editor likes you more than me... :(
>
>>I got your e-mail - thanks. For the lurkers I'll try to post the code:
>>
>>local lcSQLCommand
>>
>>TEXT TO lcSQLCommand textmerge NOSHOW PRETEXT 15
>>Update GRADS set
>>  cFName = '<<ThisForm.txtcFName.Value >>',
>>  cMInit = '<<ThisForm.txtcMInit.Value>>',
>>  etc etc..
>>endtext
>>
>>then..
>>
>>SQLExec(myhandle,lcSQLCommand)
>>
>>
>>Nice idea! Your example seems to be against a SQL backend, whereas my situation is VFP free tables. But, replacing the SQLExec with a macro command-execution ( &lcSQLCommand ) should work just fine.
>>
>>>I usually use textmerge to create the SQL command, then I execute the SQL command.
>>>
>>>UT isn't letting me give you an example (says I can't include a style attribute in a post or something). I'll send you some example code via EMAIL..
>>
>>It looks like wrapping in PRE and /PRE tags lets it work.
>>
>>
>>>
>>>
>>>>I'm using the following UPDATE command in a form method:
>>>>
>>>>LPARAMETERS ;
>>>>	tiSessID ;
>>>>	, tiSitNo
>>>>
>>>>UPDATE Grads SET ;
>>>>	cFName = ThisForm.txtcFName.Value ;
>>>>	, cMInit = ThisForm.txtcMInit.Value ;
>>>>	, cLName = ThisForm.txtcLName.Value ;
>>>>	, cStreet = ThisForm.txtcStreet.Value ;
>>>>	, cCity = ThisForm.txtcCity.Value ;
>>>>	, cProvince = ThisForm.txtcProvince.Value ;
>>>>	, cPostCode = ThisForm.txtcPostCode.Value ;
>>>>	, cPhone = ThisForm.txtcPhone.Value ;
>>>>	WHERE iSessID = tiSessID ;
>>>>		AND iSitNo = tiSitNo
>>>>
>>>>All of the target table columns and form controls ( .txtc*.Value) exist. The control values are not NULL.
>>>>
>>>>When run, I get an error "Alias 'TXTCFNAME' is not found".
>>>>
>>>>If, for test purposes I replace the ThisForm.Control.Value(s) with string literal(s) the command works fine.
>>>>
>>>>Is this a known problem, that UPDATE - SQL can't make use of form control properties this way? Any workaround other than declaring local temp variables to hold the values? TIA.
>>>>
>>>>UPDATE: never mind - it's right in the VFP Help that you can't do this, and that you need to use local variables. One place where good ol' REPLACE helps out - it doesn't complain about using object properties ;)
eCost.com continues to rip people off
Check their rating at ResellerRatings.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform