Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sql UPDATE() IMPOSSIBILITY
Message
From
09/12/2019 17:25:05
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
09/12/2019 12:33:25
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01672198
Message ID:
01672208
Views:
48
>>>Hi,
>>>
>>>I have following code in myForm.Updating method:
>>>
>>>Select curNAW
>>>liID = Id
>>>Update NAW ;
>>>    SET  ;
>>>    NAW.Voornaam = curNAW.Voornaam  , ;
>>>    NAW.geslacht = curNAW.geslacht ;
>>>    FROM  curNAW ;
>>>    where NAW.Id  = m.liID
>>>m.llSuccess = Tableupdate(.F.,.T., "naw")
>>>
>>>
>>>curNAW.Voornaam value = "Koen"
>>>m.liID =149
>>>there exsists a NAW.ID = 149
>>>nevertheless after this update, NAW.Voornaam = [ ]
>>>
>>>now when I copy this command to a testsql.prg and run that, it works as it should.
>>>I am overasked where to look to correct my method, any idea's?
>>
>>Look at the tableupdate... try with the third parameter. Without it, it works on the current alias which, as I see the code, is not the alias to which you issued the update statement.
>Dragan,
>
>My update statement:
>
>m.llSuccess = Tableupdate(.F.,.T., "naw")
>
it is naw.dbf which is the alias to which the update statement is issued.
>again the exact code works fine in .prg file
>When I issue the debugger and set a breakpoint right on the tableupdate( ) I can see naw.voornaam = [ ], so also after this tableupdate( ) it will remain empty not?
>Have checked my Data Sessions, only 1 running.

The alias was missing in your initial message, so it seemed it was trying to update the current alias (curMAW), not the table. Just removing a suspect... The next thing I'd check is the return value and what aError() returns. Also, do you have a PK set in your table? Because .t. as 2nd parameter implicitly sets wheretype=3 (PK only).
For trickier problems my favourite debugging technique is to use a cursor adapter with all methods overridden, so in the debugger you could see the exact parameters (actual SQL commands issued etc) and where it fails. Though haven't tried such techniques with dbfs, only SQL cursors.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform