pass a record id to an insert query

  • Thread starter Thread starter Jim
  • Start date Start date
J

Jim

Using .Net 3.5 vb and sql 2005 server.

I hava a page that has a GridView on it that lists items from a table -
ItemList.aspx. I want to make a hyperlink for each record that when clicked
will pass the ItemID to another page - MyItems.aspx.

The MyItems.aspx page is an "insert" formview page that I want to populate
some of the fields with the information from the record being passed. And
have other fields that the user will fillout and finally click "insert" to
put the new record into a different table.

1. Do I use a FormView for the MyItems.aspx page and set the mode to
"insert"?

2. I know how to make a master/detail page to pass the ItemID to a "select"
query, but how do I pass the ID to an "Insert" query?

I'd appreciate any hoep I can get on this one.
Thanks.
 
Jim

1. Yes, that's what I'd do; just have a FormView with the DefaultMode set to
Insert.
2. Pass the ItemID inthe same way, via the QueryString. Use a
QueryStringParameter in the InsertParameters, just as you would with a
select. When the insert command is executed, the parameter is just fetched
from the query string, rather than the form data.

d
 
Back
Top