DataTable A = new DataTable();
A.Columns.Add("MenuName", typeof(string));
A.Columns.Add("nowvisitnum", typeof(int));
DataRow drA = null;
drA = A.NewRow();
drA["MenuName"] = "库站信息";
drA["nowvisitnum"] = 20;
A.Rows.Add(drA);
drA = A.NewRow();
drA["MenuName"] = "管道信息";
drA["nowvisitnum"] = 30;
A.Rows.Add(drA);
DataTable B = new DataTable();
B.Columns.Add("MenuName", typeof(string));
B.Columns.Add("yestervisitnum", typeof(int));
DataRow drB = null;
drB = B.NewRow();
drB["MenuName"] = "库站信息";
drB["yestervisitnum"] = 4;
B.Rows.Add(drB);
drB = B.NewRow();
drB["MenuName"] = "管道信息";
drB["yestervisitnum"] = 5;
B.Rows.Add(drB);
DataTable C = new DataTable();
C.Columns.Add("MenuName", typeof(string));
C.Columns.Add("nowweek", typeof(int));
DataRow drC = null;
drC = C.NewRow();
drC["MenuName"] = "库站信息";
drC["nowweek"] = 100;
C.Rows.Add(drC);
drC = C.NewRow();
drC["MenuName"] = "管道信息";
drC["nowweek"] = 101;
C.Rows.Add(drC);
var result = from a in A.AsEnumerable()
join b in B.AsEnumerable()
on a.Field<string>("MenuName") equals b.Field<string>("MenuName")
join c in C.AsEnumerable()
on a.Field<string>("MenuName") equals c.Field<string>("MenuName")
select new
{
MenuName = a.Field<string>("MenuName"),
nowvisitnum = a.Field<int>("nowvisitnum"),
yestervisitnum = b.Field<int>("yestervisitnum"),
nowweek =c.Field<int>("nowweek"),
totaldate = DateTime.Now.ToString("yyyy-MM-dd")
};
var n1 = result.ToList();
result.ToList().ForEach(x => Console.WriteLine(x.MenuName + "-" + x.nowvisitnum + "-" + x.yestervisitnum + "-" + x.nowweek + "-" + x.totaldate));
Console.ReadKey();