How to display only second row from table to gridview?
{
SqlConnection con = new SqlConnection("server=.;database=test;trusted_connection=true");
SqlCommand cmd = new SqlCommand("select * from employee", con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds, "newemp");
GridView2.DataSource = ds.Tables[0].Rows[1].ToString();
GridView2.DataBind();
}
But it is not giving correct output...

Jaganathan BantheswaranPosted Oct 19, 2013, 5:00 AM
Why you want to display only second row?.
If its for some condition, then follow,
While getting the table values, you can query only the required rows based on your requirement.
Like,
select * from employee where dateOfJoin > '01/10/2013'
It will give you the employees who are joined after '01/10/2013'