DataTable dt = new DataTable();
dt.Columns.Add("sku", typeof(string));
dt.Columns.Add("qty", typeof(float));
dt.Columns.Add("description", typeof(string));
dt.Columns.Add("price", typeof(double));
WellsMusDataContext dc = new WellsMusDataContext();
var query = from search in dc.dbSessionCart
join jj in db.item_view on search.CustomerID equals jj.CustomerID
where search.SessionID == userID && search.StartTime == startTime
select new
{
search.sku,
search.qty,
jj.description,
jj.price
};
foreach( var rec in query )
{
DataRow dr = dt.NewRow();
dr["sku"] = rec.sku;
dr["qty"] = rec.qty;
dr["description"] = rec.description;
dr["price"] = rec.price;
dt.Rows.Add(dr);
}
DataSet ds = new DataSet();
ds.Tables.Add(dt);
|