Hi Nick,
what I meant by the underlying table is the table that the view is trying to update. If you have the table open and buffered when you tableupdatethe view, the data gets sent to the buffered table. You would then have to tableupdate the table as well.
instead of this line:
TABLEUPDATE(.T.,.T.,'lv_pinfo')
try this?
LOCAL llSuccess
m.llSuccess = TABLEUPDATE(.T.,.T.,'lv_pinfo')
if not m.llSuccess
messagebox("Save failed")
endif
you can suspend the code after the messagebox to check what AERROR contains and see why it is failing.
>>Nick,
>>
>>The normal things that cause this are:
>>
>>1. Send SQL Updates has not been checked
>>2. the fields have not been made updateable
>>3. the underlying table is buffered as well, so updating the view apparently works, but the table needs to be updated too (or remove the buffering from the table).
>>
>>>I have a parameterized updatable view called 'lv_pinfo' (foreign table) that I call to display records in a grid:
>>>
>>>
>>>lc_id = lv_person_search.personid
>>>REQUERY('lv_person')
>>>
>>>lc_id = lv_person_search.personid
>>>REQUERY('lv_pinfo')
>>>
>>>
>>>After the records are displayed in the grid, my user clicks on a button (SEVERAL TIMES) that inserts blank record in the grid. I do this by inserting the view with foreign key:
>>>
>>>
>>>
>>> insert into lv_pinfo (personid) value (lv_person.personid)
>>> TABLEUPDATE(.T.,.T.,'lv_pinfo')
>>> .pf1.p2.gridpinfo.column1.text1.setfocus()
>>> .refresh()
>>>
>>>
>>>after the blank records appear in the grid, my user next goes in the grid and fills in the information on the blank records. After that I have another button that saves the this filled information. The problem is that the information is not updating to my view on this second button. Here is the code that is suppose to save changes made on the grid:
>>>
>>>
>>> TABLEUPDATE(.T., .T., "lv_person")
>>> TABLEUPDATE(.T., .T., "lv_pinfo")
>>> .refresh()
>>>
>>>
>>>here is what the updatable view looks like. Pinfo.personid is foreign key (regular), and Pinfo.ppnextid primary key (primary) :
>>>
>>>
>>>SELECT Pinfo.personid, Pinfo.comment, Pinfo.workdate, Pinfo.workhour,;
>>> Pinfo.shiftinfo, Pinfo.ppnextid;
>>> FROM ;
>>> workprog!pinfo;
>>> WHERE Pinfo.personid = ( ?lc_id );
>>> ORDER BY Pinfo.ppnextid
>>>
>>>
>>>This has driven me nuts for about a week, there must be something I'm missing here. Does anyone see anything wrong here or have suggestions.
>>>
>>>thanks
>>>Nick
>
>Thanks for answering back. Send SQL Updates is checked on the view, all field are updatable in the view, and there are only views in my data environment. When you said underlying table, do you mean the actual table being in the data environment? If so, I only have views. The form has buffermode = 1 pessemistic and the lv_pinfo view in data environment has buffermodeoverride = 1.
>
>thanks
>Nick