如何得到数据库中的最大纪录个数(在线等)
If rs1.EOF Then
max = 0
If rs1.RecordCount <> 0 Then
rs1.MoveFirst
Do While Not rs1.EOF
If Left(rs1.CoperID.Value, 3) = Right(Left(Value_6, 6) Then
‘(满足的条件)
no1 = rs1.Fields("coperID")
If no1 > max Then
max = no1
End If
rs1.MoveNext
Else
rs1.MoveNext
End If
Loop
End If
max = max + 1
'通过循环,得出满足条件的最大编号。
CoperID,是数据库中该表的一个字段,为编号,no1,max为一变量。
请问,还有更好的方法吗?