Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Generate 'Previous' and 'Next' button with dataset
- Private Sub Command_Previous_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Command_Previous.Click
- Cnn = New MySqlConnection
- Cnn.ConnectionString = "server=127.0.0.1;user=root;password=xxx;database=database;port=3306;"
- Cnn.Open()
- Dim DA As New MySqlDataAdapter("SELECT * FROM Staff WHERE full_name < '" & lbl_Name.Text & "' ORDER BY full_name, login_id DESC", Cnn)
- Dim DS As New DataSet
- Dim DR As DataRow
- Dim CurrentRow As Integer
- DA.Fill(DS, "Staff")
- If DS.Tables(0).Rows.Count = 0 Then
- MessageBox.Show("Beginning of Record List", "User", MessageBoxButtons.OK, MessageBoxIcon.Information)
- Else
- CurrentRow = Math.Min(DS.Tables(0).Rows.Count - 1, CurrentRow + 1)
- DR = DS.Tables(0).Rows(CurrentRow)
- txt_Name.Text = DR("full_name")
- txt_Login.Text = DR("login_id")
- txt_Password.Text = DR("passwd")
- If DR("user_level").ToString = "Normal User" Then
- rad_Normal.Checked = True
- Else
- rad_Admin.Checked = True
- End If
- End If
- Cnn.Close()
- Cnn = Nothing
- End Sub
- CurrentRow = Math.Max(0, CurrentRow - 1)
- DR = DS.Tables(0).Rows(CurrentRow)
Add Comment
Please, Sign In to add comment