467,169 Members | 1,059 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,169 developers. It's quick & easy.

insert new record in detailsview - how to get master id

Here is the problem:

Using asp.net 2.0 to create a web app with standard master table gridview
and child detailsview with insert capability.
SQL Server 2000 database on the backend. Using Visual Web Developer for
front-end development.

I want to insert new records in detailsview based on selected gridview
record. All the fields in "INSERT" mode are blank, which is okay EXCEPT that
I want the child ID to be that of the selected gridview record. For example,
to put a new order for customer with customerID 367, I need 367 to be
inserted in the new Orders record.

This is a very standard database and application design problem, but can't
seem to get a solution for it.

Please help if you can

Best -

jayd
Jul 3 '06 #1
  • viewed: 3442
Share:
1 Reply
Can anyone answer this one? I am facing the same scenario. When I click
Insert on my child formview control, I get an error stating that it
cannot insert null into the parent key field in the child table. Where
do I make the connection between the parent formview data and the child
formview data?

I have the datasource for the child formview configured to use the
parent formview control for it's where clause expression, and, where
child records already exist, it works fine, but I can't get it to
insert a new record successfully in either case.

Rich
JayD wrote:
Here is the problem:

Using asp.net 2.0 to create a web app with standard master table gridview
and child detailsview with insert capability.
SQL Server 2000 database on the backend. Using Visual Web Developer for
front-end development.

I want to insert new records in detailsview based on selected gridview
record. All the fields in "INSERT" mode are blank, which is okay EXCEPT that
I want the child ID to be that of the selected gridview record. For example,
to put a new order for customer with customerID 367, I need 367 to be
inserted in the new Orders record.

This is a very standard database and application design problem, but can't
seem to get a solution for it.

Please help if you can

Best -

jayd
Jul 10 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by nsitnikov@gmail.com | last post: by
1 post views Thread by needin4mation@gmail.com | last post: by
1 post views Thread by tcc.se7en | last post: by
reply views Thread by tarscher@gmail.com | last post: by
4 posts views Thread by Mark Olbert | last post: by
5 posts views Thread by =?Utf-8?B?bXBhaW5l?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.