Hi ,
try this
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(@"Data Source=.;Initial Catalog=test;Integrated Security=True");
string statment = "select item_code, Item_name, brand, size, section, price, Material, Qty, tax, tt from Items ";
SqlDataAdapter da = new SqlDataAdapter(statment, con);
DataSet ds = new DataSet();
da.Fill(ds);
DataRow[] foundRows = ds.Tables[0].Select("item_code = 1", " item_code DESC", DataViewRowState.CurrentRows);
string statment2 = "select item_code, Item_name, brand, size, section, price, Material, Qty, tax, tt from Items where item_code = 0";
SqlDataAdapter da2 = new SqlDataAdapter(statment2, con);
DataTable dt = new DataTable();
da2.Fill(dt);
DataRow dr = dt.NewRow();
foreach (DataRow row in foundRows)
{
dr[0] = row[0];
dr[1] = row[1];
dr[2] = row[2];
dr[3] = row[3];
dr[4] = row[4];
dr[5] = row[5];
dt.Rows.Add(dr);
}
con.Close();
cmd.Dispose();
GridView1.DataSource = dt;
GridView1.DataBind();
}
Best Regards
M.Mitwalli