I have a grid view that shows to user all baskets that he or she buy in my web. My grid has check box in each row that user can select several basket to print them(Print its items in it.) When user check the check box and click the button to print them , my code check all rows in grid view and save the basket ID in a list and save it in session as list and in print page I can use it. But my problem is here : In print Page I define a DataTable with one column and fill it with basket ID. But I don't know how to join my select query with this data table
this is my query:
sqlQuery="SELECT sale.basketid as id ,sale.discount,ss.LBL as RowNo,sale.ColumnNo,Sale.ID as serial,Sale.Qty "
+ " FROM Sale INNER JOIN SansDate ON Sale.SID = SansDate.SID AND Sale.SansNumber = SansDate.SansNumber"
+ " INNER JOIN Sect ON Sale.SID = Sect.SID INNER JOIN Saloon ON Sect.SaloonID = Saloon.SaloonID left outer join saloonstructure ss on ss.saloonid=saloon.saloonid and ss.rownum=sale.rowno "
+ "where sale.basketid=" + hash.decode(Request.QueryString["param"].ToString()));
and this is my DataTable :
List<string> arraybasket = (List<string>)Session["basketArray"];
DataTable dt = new DataTable();
dt.Columns.Add("bid");
DataRow r = dt.NewRow();
for (int i = 0; i < arraybasket.Count; i++)
{
r["bid"] = arraybasket[i];
dt.Rows.Add(r);
}
in where cluse i just want to show the items that have these Basket ID in my data table (dt)
"where qsale.basketid in (1, 2, 3, 4)