Posted on: 11/19/2012 12:11:12 AM | Views : 344

I have the following code in which I have two buttons. Button1 shows the first row of table and second button willl do next:
My code:
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["MyConnection"].ToString()); SqlCommand com; SqlDataReader Dr; protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { con.Open(); com = new SqlCommand("Select * from Customers", con); Dr = com.ExecuteReader(); Dr.Read(); TextBox1.Text = Dr[0].ToString(); TextBox2.Text = Dr[1].ToString(); } protected void Button2_Click(object sender, EventArgs e) { Dr.Read(); TextBox1.Text = Dr[0].ToString(); TextBox2.Text = Dr[1].ToString(); }
Go to the complete details ...