Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Updating SQL Server table
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01655887
Message ID:
01655899
Views:
49
>>>Hi,
>>>
>>>I am calling SQL Update command from VFP application. Since I don't know if the matching record is found in the SQL Server, I want to have the results; so that I can count how many record were updated. I thought I can add the name of a cursor and "capture" this. But it does not seem to work. Here is what I am doing:
>>>
>>>
>>>cSqlUpdate = "update mytable set field1 = '1233' where id_field = 'ABC'"
>>>nResult = SQLEXEC(hCon, cSqlUpdate, "cur_result")
>>>
>>>
>>>I thought that the cursor "cur_result" would be created on successful update. But Select ("cur_result") is 0 after an update that I see worked. What am I missing?
>>>
>>>TIA
>>>
>>
>>UPDATE statement do not create cursor.
>
>Thank you.


If you want updated records as cursor than you ca use OUTPUT statement:
cSqlUpdate = "update mytable set field1 = '1233' where id_field = 'ABC' OUTPUT INSERTED.*"
nResult = SQLEXEC(hCon, cSqlUpdate, "cur_result")
SELECT cur_result
BROW NORMAL
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform