473,395 Members | 1,443 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

inserting to multiple tables in one form

I have a form that needs to add a customer and customer history in one form.

customer (custid) --->custdetail (custid)

Is there anything easy in asp.net using DataAdapter, Dataset or DataTable to
do this?

What's the best practice for doing this kind of stuff?
Nov 18 '05 #1
2 1264
Let's assume that you want to hold all of this data locally, rather than
making individual database hits (which are expensive) every time that you
select a new customer.

First, you set up a data adapter for both the customer list and the customer
history. You then fill your DataSet with each of these DataTables, based on
these adapters. Now, you have an in-memory representation of both tables.

To navigate children, you need to create a DataRelation object that
establishes the relationship between these two.

Using this, you can now get the child rows of each DataRow in your customer
DataTable, and use this to databind to your second DataGrid.

--
Chris Jackson
Software Engineer
Microsoft MVP - Windows Client
Windows XP Associate Expert
--
More people read the newsgroups than read my email.
Reply to the newsgroup for a faster response.
(Control-G using Outlook Express)
--

"Tyro" <no****@please.com> wrote in message
news:HP****************@newssvr27.news.prodigy.com ...
I have a form that needs to add a customer and customer history in one
form.

customer (custid) --->custdetail (custid)

Is there anything easy in asp.net using DataAdapter, Dataset or DataTable
to
do this?

What's the best practice for doing this kind of stuff?

Nov 18 '05 #2
You need to insert and get the custid and use that to add to the child

http://msdn.microsoft.com/library/de...mbervalues.asp
"Tyro" <no****@please.com> wrote in message
news:HP****************@newssvr27.news.prodigy.com ...
I have a form that needs to add a customer and customer history in one form.
customer (custid) --->custdetail (custid)

Is there anything easy in asp.net using DataAdapter, Dataset or DataTable to do this?

What's the best practice for doing this kind of stuff?

Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Marko Poutiainen | last post by:
Situation: We had to make our SQLServer 2000 database multi-lingual. That is, certain things (such as product names) in the database should be shown in the language the user is using (Finnish,...
4
by: Greg Ofiesh | last post by:
Anyone who can help, I have two tables T1 and T2. T1 has fields K1 and F2 and T2 has fields K2 and F1. F1 is the foreign key relating to K1 and F2 is the foreign key relating to K2. My...
6
by: Mike Wilson | last post by:
Dear Group, I have a heirarchical set of database tables, say - "order" and "order_type" and want to display a series of orders in a grid control, and in place of the order_type foreign key...
7
by: =?Utf-8?B?TG9zdEluTUQ=?= | last post by:
Hi All :) I'm converting VB6 using True DBGrid Pro 8.0 to VB2005 using DataGridView. True DBGrid has a MultipleLines property that controls whether individual records span multiple lines. Is...
0
by: t8ntboy | last post by:
ASP/SQL Server Express 05 I have two tables, A and B. I would like to insert multiple records into both form A and B, but a field in form B is the Record ID in form A. So, I need to insert the...
4
by: sialater | last post by:
Hello, I realise there are a lot of topics related to this problem but many of what I have found has run cold or unresolved. What I have is an addressbook clone where there are groups which have...
2
by: AlexanderDeLarge | last post by:
Hi! I got a problem that's driving me crazy and I'm desperately in need of help. I'll explain my scenario: I'm doing a database driven site for a band, I got these tables for their discography...
13
by: srinivas gandrath | last post by:
Hi all, I am having trouble to writing stored procedure to insert and update the 2 tables in sql server 2005. Here is my problem. I have 2 tables with following columns. TableName:BENEFIT_PDF...
3
by: simple simon | last post by:
How would I insert into multiple related tables using a table valued parameter? Is there any way to do this without using a WHILE loop? I know how to insert from a table valued parameter into one...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.