//Common Object for Web
SPWeb objweb = SPContext.Current.Web;
//First List Object
SPList olist1 = objweb.Lists["list1"];
SPListItemCollection collListItems = olist1.Items;
SPQuery oQuery1 = new SPQuery();
DataTable table1 = collListItems.GetDataTable();
//Second list object
SPList olist2 = web.Lists["list2"];
SPListItemCollection collListItems2 = olist2.Items;
DataTable table2 = collListItems2.GetDataTable();
//Merge two list
var Vout = from tbl1 in table1.AsEnumerable()
join tbl2 in table2.AsEnumerable() on tbl1["Title"] equals tbl2["ListID"]
select new
{
Fname = tbl2["Fname"],
Zip = tbl1["Zip"]
};
grdV.DataSource = Vout;
grdV.DataBind();
SPWeb objweb = SPContext.Current.Web;
//First List Object
SPList olist1 = objweb.Lists["list1"];
SPListItemCollection collListItems = olist1.Items;
SPQuery oQuery1 = new SPQuery();
DataTable table1 = collListItems.GetDataTable();
//Second list object
SPList olist2 = web.Lists["list2"];
SPListItemCollection collListItems2 = olist2.Items;
DataTable table2 = collListItems2.GetDataTable();
//Merge two list
var Vout = from tbl1 in table1.AsEnumerable()
join tbl2 in table2.AsEnumerable() on tbl1["Title"] equals tbl2["ListID"]
select new
{
Fname = tbl2["Fname"],
Zip = tbl1["Zip"]
};
grdV.DataSource = Vout;
grdV.DataBind();