Insert in detailsview based on a gridview selectedvalue



I have a detailsview that is populated according to the item selected in a
gridview. This works fine for updating the detailsview, but when I need to
add a record in the detailsview, it loses the connection, and the record is
saved with no related field id. For instance, the gridview contains a list
of orders. User selects on an item in the gridview, and the details view is
pouplated with all the products ordered according to the order selected,
something like "select * from ClientOrderDetails where ClientOrderID = @ID"

When I update a record, this is fine, as it modifies the record according to
the @ID, but when I attempt to insert a record, keeping the ClientOrderID =
@ID, it tells me there is no @ID parameter. How can I maintain this field
when inserting, or is there another way to grab that ID?

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Latest member

Latest Threads