| | |
Join Two data tables
Please support our C# advertiser: Intel Parallel Studio Home
![]() |
•
•
•
•
HI
Iam reading from excel file and I store values into data tables.
Thanks
Tank50
If you want to add relationship between two tables - one table must have a primarykey and another table must have a same datatype field in which relationship exists.
C# Syntax (Toggle Plain Text)
..... ..... // Two DataTable instances DataTable dt1=new DataTable("Table1"); DataTable dt2=new DataTable("Table2"); dt1.Columns.Add("No",typeof(int)); dt1.Columns.Add("Name"); dt2.Columns.Add("No",typeof(int)); dt2.Columns.Add("Data",typeof(int)); // Adding a primary key dt1.PrimaryKey=new DataColumn[]{dt1.Columns[0]}; // Create an instance of DataSet DataSet ds=new DataSet("DB"); ds.Tables.Add(dt1); ds.Tables.Add(dt2); ds.Relations.Add("Relation1",dt1.Columns[0],dt2.Columns[0]); ... ...
Failure is not fatal, but failure to change might be. - John Wooden
![]() |
Similar Threads
- Join Two data tables (C#)
- Pulling Data from two tables (PHP)
- how to get the difference between the data of the two files (Visual Basic 4 / 5 / 6)
- Join multiple tables (VB.NET)
- retrive data from different tables of Ms access (ASP)
- Join 3 tables (MS SQL)
Other Threads in the C# Forum
- Previous Thread: Problem with public interface
- Next Thread: installation problem
| Thread Tools | Search this Thread |
.net access algorithm array asp.net barchart bitmap box broadcast buttons c# check checkbox client combobox control conversion csharp custom database databaseconnection datagrid datagridview dataset datetime dbconnection degrees design development draganddrop drawing encryption enum event eventhandlers excel file firefox form format forms function gdi+ grantorrevokepermissionthroughc#.net httpwebrequest image index input install java label libraries list listbox loop mandelbrot math mouseclick movingimage mysql mysql.data.client operator path photoshop picturebox pixelinversion platform post programming radians regex remote remoting resourcefile richtextbox server sleep socket sql statistics stream string system.servicemodel table tcpclientchannel text textbox thread time timer update usercontrol validation visualstudio webbrowser windows winforms wpf wpfc# xml






