Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Using two datatables to create a new one

Reply
Thread Tools

Using two datatables to create a new one

 
 
Maziar Aflatoun
Guest
Posts: n/a
 
      02-05-2005
Hi,

I have two datatables,

DataTable1
dtCurProducts.Columns.Add(new DataColumn("Id",
Type.GetType("System.String")));
dtCurProducts.Columns.Add(new DataColumn("ProductId",
Type.GetType("System.String")));
dtCurProducts.Columns.Add(new DataColumn("Quantity",
Type.GetType("System.String")));
dtCurProducts.Columns.Add(new DataColumn("FinalPrice",
Type.GetType("System.String")));


DataTable2
dtProducts.Columns.Add(new DataColumn("Id", Type.GetType("System.String")));
dtProducts.Columns.Add(new DataColumn("Name",
Type.GetType("System.String")));
dtProducts.Columns.Add(new DataColumn("ProductCode",
Type.GetType("System.String")));
dtProducts.Columns.Add(new DataColumn("DefaultPrice",
Type.GetType("System.String")));

DataTable2 contains a list of all of my products. DataTable1 contains the
Quantity and the FinalPrice. Now I like to create another DataTable or
expand DataTable1 as I'm creating it to include 3 additional fields taken
from DataTable2 so that my end result would be a DataTable containing
ProductId, Quantity, Name, ProductCode, DefaultPrice and FinalPrice
(Relationship between the 2 tables defined by
DataTable1.ProductId=DataTable2.Id

Can someone please tell me how I can accomplish this? Maybe as I'm creating
the contents of DataTable1 (Given I have DataTable2)

Thank you
Maziar A.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dataset (ASP.net) has two datatables. is this normal? Randy Smith ASP .Net 1 05-09-2005 06:00 PM
Referencing two Datatables from a datalist Luis Esteban Valencia ASP .Net 0 01-11-2005 06:01 PM
Why Fill creates two datatables in dataset? John Sutter ASP .Net 3 01-13-2004 04:50 PM
Compare Two DataTables Simple Simon ASP .Net 3 12-15-2003 05:36 AM
Datatable based on two other datatables (inner join) Gene Ariani ASP .Net 0 08-21-2003 10:46 PM



Advertisments