请问老师VB中怎么自动找到1-100中缺少的数字?
请问老师VB中怎么自动找到1-100中缺少的数字?access中的一个列,1-100的数字组成,怎么自动生成缺失的数字呢?比如没有33,那自动生成33这个数字
程序代码:
Private Sub Form_Load()
Call BBB(cnn)
For I = 1 To 50
RS.Open "Select * From 数字表 Where 数字=" & I & " Order BY ID", cnn, 3, 2
If Not RS.EOF Then
AA(I) = RS!数字
Else
AA(I) = 0
SST = I
End If
If Not RS.EOF Then RS.MoveNext
RS.Close
Next I
Dim STT As Integer
RS.Open "Select * From 数字表", cnn, 3, 2
STT = RS.RecordCount
For I = 1 To STT
BB(I) = RS!数字
If Not RS.EOF Then RS.MoveNext
Next I
RS.Close
cnn.Close
Text1.Text = ""
Text2.Text = ""
Label1.Visible = False
For I = 1 To 50
If I < 10 And BB(I) > 0 Then
Text1.Text = Text1.Text & "0" & BB(I) & Space(5)
ElseIf I >= 10 And BB(I) > 0 Then
Text1.Text = Text1.Text & BB(I) & Space(5)
End If
Next I
Text2.Text = "缺少的数字是:" & SST
If SST < 1 Then
Command1.Enabled = False
Label1.Visible = True
End If
End Sub
[此贴子已经被作者于2019-9-18 19:29编辑过]
