Mencari Jumlah Rekord Pada VB6
Dim RSViewer As New ADODB.Recordset
Dim MySQL As String
Dim i As Integer
Dim JmlSiswaDiTerima As String
MySQL= "SELECT NIS FROM Tab_SiswaPKL WHERE Tab_SiswaPKL.Status='Diterima' "
Set RSViewer = New ADODB.Recordset
RSViewer.Open MySQL, DbAcax, adOpenKeyset, adLockOptimistic
If RSViewer.BOF = True And RSViewer.EOF = True Then
MsgBox "Database Kosong", vbOKOnly + vbInformation
Exit Sub
End If
RSViewer.MoveFirst
For i = 0 To RSViewer.RecordCount - 1
RSViewer.GetRows = i
Next
i = i
JmlSiswaDiTerima = i
JmlSiswaDiTerima = Format(JmlSiswaDiTerima, "###,###,##0")
TxtSiswaDiterima.Text = i & " Siswa"
TxtSiswaDiterima.Locked = True
Set RSViewer = Nothing
Dim MySQL As String
Dim i As Integer
Dim JmlSiswaDiTerima As String
MySQL= "SELECT NIS FROM Tab_SiswaPKL WHERE Tab_SiswaPKL.Status='Diterima' "
Set RSViewer = New ADODB.Recordset
RSViewer.Open MySQL, DbAcax, adOpenKeyset, adLockOptimistic
If RSViewer.BOF = True And RSViewer.EOF = True Then
MsgBox "Database Kosong", vbOKOnly + vbInformation
Exit Sub
End If
RSViewer.MoveFirst
For i = 0 To RSViewer.RecordCount - 1
RSViewer.GetRows = i
Next
i = i
JmlSiswaDiTerima = i
JmlSiswaDiTerima = Format(JmlSiswaDiTerima, "###,###,##0")
TxtSiswaDiterima.Text = i & " Siswa"
TxtSiswaDiterima.Locked = True
Set RSViewer = Nothing