HI
Can I join two data tables without any database connection,Please let me know if there way to do this.Iam using C#
Thanks
Tank50
HI
Can I join two data tables without any database connection,Please let me know if there way to do this.Iam using C#
Thanks
Tank50
Where are you getting the Data From??
HI
Iam reading from excel file and I store values into data tables.
Thanks
Tank50
HI
Iam reading from excel file and I store values into data tables.
Thanks
Tank50
You say that you want to store data from Excel file and store into two DataTable instances - You are going to split your data.
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.
.....
.....
// 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]);
...
...
Hi
I did what is adatapost is mentioned but problem its equi join,I want to join it as outer join ,coz if thre is no match record in dt1 table for dt2.Columns[0] then it give me exception.I want to join it as outer join.
Thanks
Tank50
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.