SqlDataAdapter da1 = new SqlDataAdapter("Select booking_id,user_id,convert(char,date_of_travel,103) as date_of_travel, no_of_vehicle,vehicle from booking where user_id='" + Session["a"] + "' and booking_id='" + Session["key"].ToString() + "'", con);
DataTable dt1 = new DataTable();
da1.Fill(dt1);
if (dt1.Rows.Count > 0)
{
int loop;
DataTable tbl;
DataTable tbl2 = new DataTable();
DataSet ds = new DataSet();
ds.Tables.Add(new DataTable());
ds.Tables[0].Columns.Add("ID", typeof(int));
ds.Tables[0].Columns.Add("Tour_Code", typeof(int));
ds.Tables[0].Columns.Add("Tour_Date", typeof(string));
ds.Tables[0].Columns.Add("Vehicle", typeof(string));
tbl2 = ds.Tables[0].Clone();
loop = Convert.ToInt32(dt1.Rows[0][3].ToString());
for (int i = 0; i < loop; i++)
{
SqlDataAdapter adp = new SqlDataAdapter("Select booking_id as ID,user_id as Tour_Code,convert(char,date_of_travel,103) as Tour_Date, vehicle as Vehicle from booking where user_id='" + Session["a"] + "' and booking_id='" + Session["key"].ToString() + "'", con);
tbl = new DataTable();
adp.Fill(tbl);
foreach (DataRow dr in tbl.Rows)
{
DataRow newRow = tbl2.NewRow();
newRow.ItemArray = dr.ItemArray;
tbl2.Rows.Add(newRow);
}
}
grdveh.DataSource = tbl2;
grdveh.DataBind();
}