General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Tableupdate() updates all recs in tbl instead of current row
Help!
ControlSource of my text fields in my form class is set to fields in my updatable cursor (.ControlSouce='cMyTable.myFieldName'). Whenever I make changes to a text field, & clicked on a command button that issues a TABLEUPDATE(0,.T.), it updates the original table with the new value for the related field, but it does so for all the records in the table (which I do not want) instead of the current record only (which is what I'd like it to do).
I had it working properly at 1 time, but I had made changes since, including creating another updatable cursor (in myForm.LOAD). Can anybody give me a clue where the problem might be?
myForm.Load()
lcConnStr="DRIVER={Microsoft Visual FoxPro Driver};" + ;
"SourceDB=c:\projects\myData.dbc;SourceType=DBC;UID=;PWD=;"
lnHandle=SQLSTRINGCONNECT(lcConnStr)
IF lnHandle>0
lSuccessMyTable=SQLEXEC(lnHandle,"SELECT * FROM myTable","cMyTable")
IF lSuccessMyTable=1
SET MULTILOCKS ON
CURSORSETPROP('Buffering',5,'cMyTable')
CURSORSETPROP('TABLES','myTable','cMyTable')
CURSORSETPROP('UPDATABLEFIELDLIST','refno,budgetcode','cMyTable')
CURSORSETPROP('KeyFieldList','refno','cMyTable')
CURSORSETPROP('UpdateNameList','refno myTable.RefNo,budgetcode myTable.budgetcode','cMyTable')
CURSORSETPROP('FetchMemo',.T.,'cMyTable')
CURSORSETPROP('SendUpdates',.T.,'cMyTable')
ENDIF
ENDIF
cmdSave.CLICK()
TABLEUPDATE(0,.T.)
**Let's say I changed budgetcode to 15 on record with refno=13.
**The TABLEUPDATE changes all budgetcode to 15 for all records, not just for refno=13. The above code seems to be working just by itself; there must be a mistake I made somewhere else, but I'm clueless. Can anybody give me a clue?
Thank you all!
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only