Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Buffering and Tableupdate()
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01113462
Message ID:
01113494
Views:
16
>>>If the controls on a form display and operate on data contained in a temporary cursor, how do you save the revised data back into the original table? I'm experimenting with the following code sequence to try and figure this out but I can't seem to get it right.
>>>
>>>
>>>select * from test_financing into cursor crstemp readwrite
>>>set multilocks on
>>>=cursorsetprop("buffering",5,"test_financing")
>>>select crstemp
>>>go top
>>>replace amount with 2000
>>>=tableupdate()
>>>
>>>
>>>Any help will be appreciated.
>>
>>Use CursorAdapter or Updatable Local View for this.
>>I suupose this is only an example of what you want to do, but if you do this in a regular bases you must consider using LV or CA. That will make you life easier :o)
>----------------------------------------------------------------------
>
>Thanks guys. This situation has additional complexities that will have to be dealt with. Such as . . . the views will need to be constructed dynamically. Is that possible? I constructed a test view to experiment with, the code is:
>
>
>SELECT Test_financing.tip_id, Test_financing.amount,;
>  Test_financing.source, Test_financing.year, Test_financing.phase;
> FROM ;
>     Z:\DFREEMAN\TIP\DATA\TEST_FINANCING.DBF;
> WHERE  Test_financing.year = ( 2007 );
> ORDER BY Test_financing.tip_id
>
>DBSetProp(ThisView,"View","SendUpdates",.F.)
>DBSetProp(ThisView,"View","BatchUpdateCount",1)
>DBSetProp(ThisView,"View","CompareMemo",.T.)
>DBSetProp(ThisView,"View","FetchAsNeeded",.F.)
>DBSetProp(ThisView,"View","FetchMemo",.T.)
>DBSetProp(ThisView,"View","FetchSize",100)
>DBSetProp(ThisView,"View","MaxRecords",-1)
>DBSetProp(ThisView,"View","Prepared",.F.)
>DBSetProp(ThisView,"View","UpdateType",1)
>DBSetProp(ThisView,"View","UseMemoSize",255)
>DBSetProp(ThisView,"View","Tables","test_financing")
>DBSetProp(ThisView,"View","WhereType",3)
>
>DBSetProp(ThisView+".tip_id","Field","DataType","N(6,2)")
>DBSetProp(ThisView+".tip_id","Field","UpdateName","test_financing.tip_id")
>DBSetProp(ThisView+".tip_id","Field","KeyField",.F.)
>DBSetProp(ThisView+".tip_id","Field","Updatable",.T.)
>
>DBSetProp(ThisView+".amount","Field","DataType","N(6)")
>DBSetProp(ThisView+".amount","Field","UpdateName","test_financing.amount")
>DBSetProp(ThisView+".amount","Field","KeyField",.F.)
>DBSetProp(ThisView+".amount","Field","Updatable",.T.)
>
>DBSetProp(ThisView+".source","Field","DataType","C(5)")
>DBSetProp(ThisView+".source","Field","UpdateName","test_financing.source")
>DBSetProp(ThisView+".source","Field","KeyField",.F.)
>DBSetProp(ThisView+".source","Field","Updatable",.T.)
>
>DBSetProp(ThisView+".year","Field","DataType","N(4)")
>DBSetProp(ThisView+".year","Field","UpdateName","test_financing.year")
>DBSetProp(ThisView+".year","Field","KeyField",.F.)
>DBSetProp(ThisView+".year","Field","Updatable",.T.)
>
>DBSetProp(ThisView+".phase","Field","DataType","C(5)")
>DBSetProp(ThisView+".phase","Field","UpdateName","test_financing.phase")
>DBSetProp(ThisView+".phase","Field","KeyField",.F.)
>DBSetProp(ThisView+".phase","Field","Updatable",.T.)
>
>
>
>but it errors if I try to run it as a program. Also, if I :
>
>
>use testview
>repl amount with somenumber
>=tableupdate()
>
>the new data is not saved back into the original file. So I must still be missing something.


Change this line:
DBSetProp(ThisView,"View","SendUpdates",.F.)

to this:
DBSetProp(ThisView,"View","SendUpdates",.T.)
ICQ 10556 (ya), 254117
Previous
Reply
Map
View

Click here to load this message in the networking platform