Ranjana Sharma

Ranjana Sharma

  • NA
  • 3
  • 7.9k

move to next record

Oct 28 2010 6:15 AM
   Dim i As Integer
        Dim con As New SqlConnection("Data Source=QADCOM7026;Initial Catalog=stu_info1;Integrated Security=True")
        con.Open()
        Dim adp As New SqlDataAdapter("select * from stu_info", con)
        Dim builder As New SqlCommandBuilder(adp)
        Dim ds As New DataSet()
        adp.Fill(ds, "stu_info")

        If (i < ds.Tables(0).Rows.Count - 1) Then
            i = i + 1


            textBox1.Text = ds.Tables(0).Rows(i)("First_name").ToString()
            textBox2.Text = ds.Tables(0).Rows(i)("Last_name").ToString()
            textBox3.Text = ds.Tables(0).Rows(i)("Address").ToString()
            textBox4.Text = ds.Tables(0).Rows(i)("Phone_no").ToString()
            textBox5.Text = ds.Tables(0).Rows(i)("City").ToString()
        Else
            MessageBox.Show("this is first record")

        End If
this shows only one next record,i want to move next record each time on button click...


Answers (2)