|
 |
asp_databases thread: Beginning ASP 3.0: Updating 2 tables
Message #1 by "WVerner" <w_verner@h...> on Mon, 17 Mar 2003 21:31:10
|
|
Hello All,
I have been learning ASP and have recently purchased the excellent
Beginning ASP 3.0 book. I worked
through the examples and have focused on building the classifieds
example in the middle of the book. Howrever i am tryin to experiment with
it, and what i am trying to do is this:
1)The user can click a link to bring up all the items in the database they
have added
2)The user can then click a particular item (which is a link) to bring
them to a page with the details of that item
This is similar to the add/edit feature which the guys in the book have
implemented.
Now instead of the add or delete option i wish to add another button-
Approve Item. So if a user puts an item up for sale they can delay putting
it fr sale until they approve it. If they decide to definately post it for
sale they can click approve: This will approve the item for selling and
will initiate the following to occur:
1) Approve the item and add the record displayed to an ApprovedItems table
and
2) Delete the item from the old Items table (to save on memory)
The items in the Approved Items table will be made available to view by
users.
How do i implement such a page? To delete from one table whilst at same
time adding the same record to another table?
Thanks to anyone who reads this and can help!
Message #2 by skip@f... on Tue, 18 Mar 2003 01:47:54
|
|
If you were to do this, perhaps the most efficient way would be to open 2
recordsets, say, Items and ApprovedItems, on the same connection. Open
Items using the default Recordset properties and the ApprovedItems as
either a Dynamic or Keyset type recordset using Optimistic locking. Find
the approved record in the Items recordset, then, programmatically, copy
the fields from Items to ApprovedItems thusly (repeat as needed for all
corresponding fields):
rsApprovedItems("<field-name>")=rsItems("<field-name>")
Then update:
rsApprovedItems.Update
If all goes well (always trap for errors!), then delete the Items record:
rsItems.Delete
rsItems.MoveNext
Seems like a lot of work, though. Have you considered simply adding a
boolean-type "Approved" field to the Items table?
Skip
Message #3 by "WVerner" <w_verner@h...> on Tue, 18 Mar 2003 12:28:12
|
|
> Hello All,
I> have been learning ASP and have recently purchased the excellent
B> eginning ASP 3.0 book. I worked
t> hrough the examples and have focused on building the classifieds
e> xample in the middle of the book. Howrever i am tryin to experiment
with
i> t, and what i am trying to do is this:
> 1)The user can click a link to bring up all the items in the database
they
h> ave added
2> )The user can then click a particular item (which is a link) to bring
t> hem to a page with the details of that item
>
T> his is similar to the add/edit feature which the guys in the book have
i> mplemented.
> Now instead of the add or delete option i wish to add another button-
A> pprove Item. So if a user puts an item up for sale they can delay
putting
i> t fr sale until they approve it. If they decide to definately post it
for
s> ale they can click approve: This will approve the item for selling and
w> ill initiate the following to occur:
> 1) Approve the item and add the record displayed to an ApprovedItems
table
a> nd
2> ) Delete the item from the old Items table (to save on memory)
>
T> he items in the Approved Items table will be made available to view by
u> sers.
> How do i implement such a page? To delete from one table whilst at same
t> ime adding the same record to another table?
> Thanks to anyone who reads this and can help!
Message #4 by "WVerner" <w_verner@h...> on Tue, 18 Mar 2003 12:30:19
|
|
Thank skip,
now i hadnt thought of the boolean option. So i could put another field in
the items field Approved-Yes/No. WOuld this allow me then to say for
example display to users only records that have been approved? and to hide
ones that havent? cos this is essentially what i need to do.
thanks
|
|
 |