Question : Can not add two lists

using (WellsMusDataContext dc = new WellsMusDataContext())
            {
                var query = (from search in dc.dbSessionCart
                            join jj
                               in dc.item_view on search.sku equals jj.sku
                            where search.SessionID == userId &&
                               search.StartTime == startTime
                             select new { search.sku, search.qty, jj.description, jj.price }).ToList();

               List<item_view> newlist = new List<item_view>();
               List<dbSessionCart> kl = new List<dbSessionCart>();
                           
              foreach (var p in query)
                {
                    ne.Add(new string() {name = p.qty});
               
                }



               
               foreach (var q in query)
             {
                   newlist.Add(new item_view() { sku = q.sku, description = q.description, price = q.price});
              }
How can i add two lists kl and newlist and convert to dataset

Answer : Can not add two lists

Hi reddy999;

This should do what you want.

Fernando
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
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);
Random Solutions  
 
programming4us programming4us