If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Other > [ Visual FoxPro ] Updating a view ...

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-13-04, 05:20
jeoff jeoff is offline
Registered User
 
Join Date: Apr 2004
Posts: 7
[ Visual FoxPro ] Updating a view ...

I have read lots of things about this problem but i have found no solutions.

Here is what i have already done in my code:

Set MultiLocks ON

CursorSetProp('Buffering',3,'vue1')

DBSETPROP('vue1','View','Tables','table1')
DBSETPROP('vue1','View','Tables','table2')

DBSETPROP('vue1.idclient','Field','KeyField',.T.)

DBSETPROP('vue1.idclient','Field','Updatable',.T.)
DBSETPROP('vue1.nomclient','Field','Updatable',.T. )
DBSETPROP('vue1.nomdep','Field','Updatable',.T.)

DBSETPROP('vue1','View','SendUpdates',.T.)


And here is my update code:

dimension numd(1)
numd[1]=0

Select numdep from table2 where nomdep=m.valeur into array numd

If numd[1]==0 and m.opened==1
Select max(numdep)+1 from table2 into array numd
Insert into table2 (numdep,nomdep) values (numd,m.valeur)
endif


if m.opened==1
m.idclient=Val(m.idclient)
Update table1 set numdep=numd where idclient=m.idclient
&&Update vue1 set nomdep=m.valeur where idclient=m.idclient
TableUpdate(0,.F.,'vue1')
endif

m.opened=0

ThisForm.Grid1.Column1.ControlSource="vue1.idclien t"
ThisForm.Grid1.Column2.ControlSource="vue1.nomclie nt"
ThisForm.Grid1.Column3.ControlSource="vue1.nomdep"

ThisForm.Refresh



The problem is that my view is never updated while my tables are.
I have also checked the Send Update property in the Update Tab

Thank you for help
Reply With Quote
  #2 (permalink)  
Old 04-13-04, 07:48
zeus77 zeus77 is offline
Registered User
 
Join Date: Mar 2004
Location: Venice,Italy
Posts: 20
'SendUpdates' property is usefull only on remote view (with mssql server)
I don't see the definition of the view; one thing: you use the view for grid visualization only?
Reply With Quote
  #3 (permalink)  
Old 04-13-04, 08:45
jeoff jeoff is offline
Registered User
 
Join Date: Apr 2004
Posts: 7
i use only a local view at the moment and show it in a grid.

The user modify the tables by doubleclicking the fields of the grid.
Then a box appears and ask him the new value and to press a "Validate" button.

Actually, all works fine,except the fact that my tables are updated but my view isn't.

I hope this can help
Reply With Quote
  #4 (permalink)  
Old 04-14-04, 03:43
zeus77 zeus77 is offline
Registered User
 
Join Date: Mar 2004
Location: Venice,Italy
Posts: 20
one solution is to use a cursor instead of a view, something like this:

select * from table1 into cursor tmp_read nofilter
afield(aStruct,"tmp_read")
create cursor vue1 from array aStruct
select vue1
append from dbf("tmp_read")
select tmp_read
use

without setting any property
another one is to regenerate the view/cursor under the grid.
however to refresh the grid the method "refresh" not work well: you have to do :
ThisForm.Grid1.recordsource=ThisForm.Grid1.records ource
Reply With Quote
  #5 (permalink)  
Old 04-14-04, 04:46
jeoff jeoff is offline
Registered User
 
Join Date: Apr 2004
Posts: 7
ok, thanks a lot.
I will try this today .
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On