Dim Con As New ADODB.Connection
Dim Rs As New ADODB.Recordset
Dim i%
Private Sub Form_Load()
Con.ConnectionString = "Driver={sql server};server=wjpc;uid=sa;pwd=;database=db_2008"
Con.Open
Rs.Open "select * from aa", Con, adOpenKeyset, adLockOptimistic
Set MS1.DataSource = Rs
For i = 0 To 3
Text1(i) = Rs.Fields(i)
Next
End Sub
Private Sub Cmd_first_Click()
If Rs.BOF <> True Then
Rs.MoveFirst
For i = 0 To 3
Text1(i) = Rs.Fields(i)
Next
End If
End Sub
Private Sub Cmd_up_Click()
On Error Resume Next
Rs.MovePrevious
If Rs.BOF Then
Rs.MoveNext
Exit Sub
Else
For i = 0 To 3
Text1(i) = Rs.Fields(i)
Next
End If
End Sub
Private Sub Cmd_down_Click()
On Error Resume Next
Rs.MoveNext
If Rs.EOF Then
Rs.MovePrevious
Exit Sub
Else
For i = 0 To 3
Text1(i) = Rs.Fields(i)
Next
End If
End Sub
Private Sub Cmd_last_Click()
If Rs.EOF <> True Then
Rs.MoveLast
For i = 0 To 3
Text1(i) = Rs.Fields(i)
Next
End If
End Sub