i manage to use the next and previous button in my program..the problem is it only show the last data on my my database that is when i click the next button..same as the previous button... i used the code that was given and fix all the mistake.... but it wont show other data that was stored in the database... could u guys give me a a hand..i really appreciate alot if u guys would spare the time and help me...
"this is the code for next and previous button"
Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNext.Click
Dim varConnection As New SqlConnection
Dim varDataSet As New DataSet
Dim varAdapter As SqlDataAdapter
Dim varCommand As SqlCommand
Dim varchar As SqlDataAdapter
Dim Record_num = 0
Dim sql As String
varConnection = New SqlConnection("Server=(local);user id=sa;password=;Initial Catalog=ROP1")
sql = "SELECT * FROM tbl_rop"
sql = "SELECT distinct * FROM tbl_rop"
'Dim con As String = ConfigurationSettings.AppSettings("preeconn")
varCommand = New SqlCommand(varQuery, varConnection)
varCommand = New SqlCommand(sql, varConnection)
varAdapter = New SqlDataAdapter(varCommand)
varAdapter.Fill(varDataSet) 'used to get the count of number of rows in a table
Record_num = 0
TextBox1.Text = varDataSet.Tables(0).Rows(Record_num).Item("Name_User")
TextBox2.Text = varDataSet.Tables(0).Rows(Record_num).Item("Date_of_birth")
TextBox3.Text = varDataSet.Tables(0).Rows(Record_num).Item("Hobbies")
TextBox4.Text = varDataSet.Tables(0).Rows(Record_num).Item("Phone_number")
End Sub
___________________________________________________________________________
Private Sub btnPrevious_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrevious.Click
Dim varConnection As New SqlConnection
Dim varDataSet As New DataSet
Dim varAdapter As SqlDataAdapter
Dim varCommand As SqlCommand
Dim varchar As SqlDataAdapter
Dim Record_num = 0
Dim sql As String
varConnection = New SqlConnection("Server=(local);user id=sa;password=;Initial Catalog=ROP1")
sql = "SELECT * FROM tbl_rop"
sql = "SELECT distinct * FROM tbl_rop"
'Dim con As String = ConfigurationSettings.AppSettings("preeconn")
varCommand = New SqlCommand(varQuery, varConnection)
varCommand = New SqlCommand(sql, varConnection)
varAdapter = New SqlDataAdapter(varCommand)
varAdapter.Fill(varDataSet) 'used to get the count of number of rows in a table
Record_num = +1
TextBox4.Text = varDataSet.Tables(0).Rows(Record_num).Item("Phone_number")
TextBox3.Text = varDataSet.Tables(0).Rows(Record_num).Item("Hobbies")
TextBox2.Text = varDataSet.Tables(0).Rows(Record_num).Item("Date_of_birth")
TextBox1.Text = varDataSet.Tables(0).Rows(Record_num).Item("Name_User")
End Sub
____________________________________________________________________________
i really appreciate alot if u can help me spot the problem... thankz..