MYSQL VISUAL BASIC 6 - NAVEGANDO PELA TABELA
Bom Dia, pessoal qual é a melhor forma de navegar pelo Dados Cadastrados de uma tabela em MySQL 5.1
Ex.
Private Sub ShowData()
Dim RS As ADODB.Recordset
Set RS = New ADODB.Recordset
RS.CursorLocation = adUseClient
RS.CursorType = adOpenStatic
RS.LockType = adLockReadOnly
RS.Open [Ô]SELECT * FROM tabest1[Ô], MyConnectionDataBase
If RS.EOF = True Then
RS.Close
Set RS = Nothing
Exit Sub
End If
xCount = RS.RecordCount
If Rx > RS.RecordCount - 1 Then
Rx = 0
End If
If Rx < 0 Then
Rx = RS.RecordCount - 1
End If
RS.Move Rx
TextBox.Text = RS.Fields([Ô]Controle[Ô])
RS.Close
Set RS = Nothing
End Sub
Private Sub Command1_Click()
On Error Resume Next
Rx = Rx - 1
ShowData
End Sub
Private Sub Command2_Click()
On Error Resume Next
Rx = 0
ShowData
End Sub
Private Sub Command3_Click()
On Error Resume Next
Rx = xCount - 1
ShowData
End Sub
Private Sub Command4_Click()
On Error Resume Next
Rx = Rx + 1
ShowData
End Sub
Ex.
Private Sub ShowData()
Dim RS As ADODB.Recordset
Set RS = New ADODB.Recordset
RS.CursorLocation = adUseClient
RS.CursorType = adOpenStatic
RS.LockType = adLockReadOnly
RS.Open [Ô]SELECT * FROM tabest1[Ô], MyConnectionDataBase
If RS.EOF = True Then
RS.Close
Set RS = Nothing
Exit Sub
End If
xCount = RS.RecordCount
If Rx > RS.RecordCount - 1 Then
Rx = 0
End If
If Rx < 0 Then
Rx = RS.RecordCount - 1
End If
RS.Move Rx
TextBox.Text = RS.Fields([Ô]Controle[Ô])
RS.Close
Set RS = Nothing
End Sub
Private Sub Command1_Click()
On Error Resume Next
Rx = Rx - 1
ShowData
End Sub
Private Sub Command2_Click()
On Error Resume Next
Rx = 0
ShowData
End Sub
Private Sub Command3_Click()
On Error Resume Next
Rx = xCount - 1
ShowData
End Sub
Private Sub Command4_Click()
On Error Resume Next
Rx = Rx + 1
ShowData
End Sub
Amigo, eu sempre usei o mesmo método de sql, que uso no access.
Tópico encerrado , respostas não são mais permitidas