I have defined two views.

create sql view t_theorder remote connect myconn ;
as select * from orders ;
where orderid=?m.orderid
=dbsetprop("t_theorder","view","sendupdates",.t.)
=dbsetprop("t_theorder","view","tables","orders")
=dbsetprop("t_theorder.orderid","field","keyfield",.t.)

create sql view t_theodetail remote connect myconn ;
as select * from "order details" ;
where orderid=?m.orderid
=dbsetprop("t_theodetail","view","sendupdates",.t.)
=dbsetprop("t_theodetail","view","tables","order details")
=dbsetprop("t_theodetail.orderid","field","keyfield",.t.)
=dbsetprop("t_theodetail.productid","field","keyfield",.t.)

I then use the following commands to delete the records:

m.orderid=t_orders.orderid
select 0
use t_theodetail shared
=cursorsetprop("buffering",5,"t_theodetail")
delete all
if tableupdate(.t.)
select 0
use t_theorder shared
=cursorsetprop("buffering",5,"t_theorder")
delete
if !tableupdate(.t.)
a_error[1]=.f.
=aerror(a_error)
=tablerevert(.t.)
=messagebox("Error deleting header. "+a_error[2],48)
endif
else
a_error[1]=.f.
=aerror(a_error)
=tablerevert(.t.)
=messagebox("Error deleting detail. "+a_error[2],48)
endif
if used("t_theorder")
use in t_theorder
endif
if used("t_theodetail")
use in t_theodetail
endif

Then I hit an eror "No Update Tables specified. Use the Tables property
of the cursor". I had no idea what I did wrong.

--
.~. Might, Courage, Vision. In Linux We Trust.
/ v \ http://www.linux-sxs.org
/( _ )\ Linux 2.4.22-xfs
^ ^ 11:08pm up 12 days, 23:40, 0 users, load average: 1.15, 1.07, 1.03

Re: using view to delete records by Stefan

Stefan
Thu Feb 05 06:04:05 CST 2004

> =dbsetprop("t_theodetail","view","tables","order details")

I think one problem might be the "illegal" table name
containing a space. I'd try square brackets
dbsetprop("t_theodetail","view","tables","[order details]")
and maybe additionally define the fields' UpdateName
properties like
dbsetprop("t_theodetail.orderid","field", ;
"UpdateName", '[order details].orderID')


hth
-Stefan

"toylet" <toylet@mail.hongkong.com> schrieb im Newsbeitrag
news:uQ7lCEz6DHA.2644@TK2MSFTNGP11.phx.gbl...
> I have defined two views.
>
> create sql view t_theorder remote connect myconn ;
> as select * from orders ;
> where orderid=?m.orderid
> =dbsetprop("t_theorder","view","sendupdates",.t.)
> =dbsetprop("t_theorder","view","tables","orders")
> =dbsetprop("t_theorder.orderid","field","keyfield",.t.)
>
> create sql view t_theodetail remote connect myconn ;
> as select * from "order details" ;
> where orderid=?m.orderid
> =dbsetprop("t_theodetail","view","sendupdates",.t.)
> =dbsetprop("t_theodetail","view","tables","order details")
> =dbsetprop("t_theodetail.orderid","field","keyfield",.t.)
> =dbsetprop("t_theodetail.productid","field","keyfield",.t.)
>
> I then use the following commands to delete the records:
>
> m.orderid=t_orders.orderid
> select 0
> use t_theodetail shared
> =cursorsetprop("buffering",5,"t_theodetail")
> delete all
> if tableupdate(.t.)
> select 0
> use t_theorder shared
> =cursorsetprop("buffering",5,"t_theorder")
> delete
> if !tableupdate(.t.)
> a_error[1]=.f.
> =aerror(a_error)
> =tablerevert(.t.)
> =messagebox("Error deleting header. "+a_error[2],48)
> endif
> else
> a_error[1]=.f.
> =aerror(a_error)
> =tablerevert(.t.)
> =messagebox("Error deleting detail. "+a_error[2],48)
> endif
> if used("t_theorder")
> use in t_theorder
> endif
> if used("t_theodetail")
> use in t_theodetail
> endif
>
> Then I hit an eror "No Update Tables specified. Use the Tables property
> of the cursor". I had no idea what I did wrong.
>
> --
> .~. Might, Courage, Vision. In Linux We Trust.
> / v \ http://www.linux-sxs.org
> /( _ )\ Linux 2.4.22-xfs
> ^ ^ 11:08pm up 12 days, 23:40, 0 users, load average: 1.15, 1.07,
1.03