i want to retrieve 2nd row of a column from datareader object...

i want to show 1st row value of datareader..... if seattype_code == "00", 2nd row value if seattype_code == "01"...and so on.....

what method shud i use for dr..as it is not working that i tried..?

dr = cmd.ExecuteReader();
                        if (dr.HasRows)
                        {
                            if(dr.Read())
                            {

                                if(seattype_code == "00")
                                {
                                    lblSeatType.Text = dr.GetString(0).ToString();
                                }
                                else 
                                    if (seattype_code == "01")
                                {
                                    lblSeatType.Text = dr.GetInt32(1).ToString();
                                }
                                else if (seattype_code == "02")
                                {
                                    lblSeatType.Text = dr.GetInt32(2).ToString();
                                }
                                else if (seattype_code == "03")
                                {
                                    lblSeatType.Text = dr.GetChars.GetString(3).ToString();
                                }

thnx in advance..

Edited 3 Years Ago by Reverend Jim: Fixed formatting

You can not. Data reader works with current row only. You can, however, buffer read data, or use data table.

This article has been dead for over six months. Start a new discussion instead.