Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Changes in the grid not updating view
Message
From
11/04/2005 09:38:24
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Novell 6.x
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01002667
Message ID:
01003333
Views:
19
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 &&drop down box select record
>>>REQUERY('lv_person') && parent record
>>>
>>>lc_id = lv_person_search.personid &&drop down box select record
>>>REQUERY('lv_pinfo') &&get child records
>>>
>>>
>>>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:
>>>
>>>
>>>&&cmdcreateblank
>>>	insert into lv_pinfo (personid) value (lv_person.personid) && this is creating blank records in the grid
>>>	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") &&parent table
>>>	TABLEUPDATE(.T., .T., "lv_pinfo") &&child table this should update my grid changes but it doesn't work
>>>	.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
Frank.

Frank Cazabon
Samaan Systems Ltd.
www.samaansystems.com
Previous
Reply
Map
View

Click here to load this message in the networking platform