Sreekanth Reddy

Sreekanth Reddy

  • 353
  • 4.8k
  • 421.4k

Binding 2nd row from table into gridview.

Oct 18 2013 2:07 PM
How to display only second row from table to gridview?

 
I had written the code as follows: protected void Page_Load(object sender, EventArgs e)
{
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...

Answers (1)