Hi,
I need to build a page to add entries to several tables. There is one main table and 4 other tables that have foreign key relationships with the main table.
The primary key in the main table is auto generated.
I know I can insert into the first table, then grab the newly generated primary key value and use it to insert into the other tables.
But I'm not sure how to design a page like this and I was hoping someone had done something similar or could give me some ideas. I'm not sure if it would be better to do it step by step (insert into main table first, then let the user enter the data for the other tables) or if it would be better to build some kind of display that allows the user to enter all the data for all the tables on the same page before updating it. The second option would probably be preferable because then I could wrap everything in a transaction and not have to worry about a record getting inserted in the main table with no related data in the other tables.
I'm fairly new to ASP.Net. Is it possible to use a datagrid to allow a user to enter data in multiple rows? I was thinking I could have one set of text boxes for the values for the main table, then some kind of grid for each of the other tables to allow multiple rows to be entered.
Any ideas are appreciated.
Thanks
I need to build a page to add entries to several tables. There is one main table and 4 other tables that have foreign key relationships with the main table.
The primary key in the main table is auto generated.
I know I can insert into the first table, then grab the newly generated primary key value and use it to insert into the other tables.
But I'm not sure how to design a page like this and I was hoping someone had done something similar or could give me some ideas. I'm not sure if it would be better to do it step by step (insert into main table first, then let the user enter the data for the other tables) or if it would be better to build some kind of display that allows the user to enter all the data for all the tables on the same page before updating it. The second option would probably be preferable because then I could wrap everything in a transaction and not have to worry about a record getting inserted in the main table with no related data in the other tables.
I'm fairly new to ASP.Net. Is it possible to use a datagrid to allow a user to enter data in multiple rows? I was thinking I could have one set of text boxes for the values for the main table, then some kind of grid for each of the other tables to allow multiple rows to be entered.
Any ideas are appreciated.
Thanks