Nevigate Data Set - C# 2005

Mar 12 2008 6:08 AM

Dear Friends,

I need to know that how do you nevigate data in a table. I'm going to use four buttons for MoveFirst, MoveLast, Previous and Next. But I don't know, please anybody can help me.......

I developed the given below coding to read the first record in the table in the DB.(anybody can comment on this also) But I want a solution for nevigation on the recordset.

 

 public void DisplayScheculeType()
        {
            SqlConnection s = new SqlConnection(con1.SetConnection());
           
            s.Open();

            SqlCommand com = new SqlCommand("select * from CM_SCHEDTYPE", s);
            SqlDataReader r;
            r = com.ExecuteReader();

            string ScheType1 = "";
            string Scheduledesp1 = "";

            if (r.Read())
            {
                ScheType1 =(string)r.GetValue(0);
                Scheduledesp1 = (string)r.GetValue(1);
            }

            r.Close();
            s.Close();

            SchedCode.Text = ScheType1;
            ScheDesp.Text = Scheduledesp1;
        }