SqlConnection conn = new SqlConnection(Connection);
SqlDataAdapter daprod = new SqlDataAdapter("select * from tbl_details", conn);
daprod.SelectCommand.CommandType = CommandType.Text;
DataSet dsprod = new DataSet();
daprod.Fill(dsprod);
DataTable productDataTable = new DataTable();
productDataTable = dsprod.Tables["Table"];
DataView view = new DataView(productDataTable);
view.Sort = "Emp_Last_Logged_In DESC";
DataTable dt = view.ToTable();
DataTable cloneDataTable = dt.Clone();
for (int i = 0; i < 5; i++)
{
cloneDataTable.ImportRow(dt.Rows[i]);
}
GridView1.DataSource = cloneDataTable;
GridView1.DataBind();