| | |
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]); ... ...
![]() |
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 |
Tag cloud for C#
.net access ado.net algorithm array barchart bitmap box broadcast buttons c# chat check checkbox class client color combobox control conversion csharp custom database datagrid datagridview dataset datetime degrees development draganddrop drawing encryption event excel file files form format forms function gdi+ httpwebrequest image index input install java label list listbox listener login mandelbrot math mouseclick mysql networking object operator path photoshop picturebox pixelinversion post prime programming radians regex remote remoting resource richtextbox save saving serialization server sleep socket sql statistics stream string table tcp text textbox thread time timer treeview update usercontrol validation view visualstudio webbrowser windows winforms wpf xml






