471,337 Members | 829 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,337 software developers and data experts.

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
1 3567
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 | last post: by
1 post views Thread by needin4mation | last post: by
1 post views Thread by tcc.se7en | last post: by
reply views Thread by tarscher | 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 Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.