5.1.2遇到重复号码时的处理方案
当系统随机抽到一个重复的号码时,系统会提醒该号码已经抽过,本次抽取结果无效,继续下一次抽取。代码如下:
If RstSQL.Fields("Checked") = True Then
cmdOK.Enabled = False
cmdCancel.Enabled = True
cmdCancel.SetFocus
MsgBox "此号码已经抽到过并且已经做了保存! ", vbInformation + vbOKOnly, "提示信息"
Else
cmdOK.Enabled = True
cmdCancel.Enabled = True
cmdOK.SetFocus
End If
5.1.3系统管理员对所抽取的号码进行保存
系统管理员对所抽取的号码进行保存时假如结果无误就回把此号码保存进“中奖者数据库”中,如果保存失败系统也会提供相应的信息。如下:
Private Sub cmdOK_Click()
Dim RstSQL As New ADODB.Recordset
On Error GoTo errLable
With RstSQL
.ActiveConnection = CnnDSN
.LockType = adLockOptimistic
.CursorType = adOpenStatic
.Source = "UPDATE Lottery_Table SET Checked='1' WHERE Person_ID=" & Int(Text10.Text) & ""
.Open
End With
cmdOK.Enabled = False
cmdCancel.Enabled = False
cmdBegin.SetFocus
MsgBox "保存成功! ", vbInformation + vbOKOnly, "提示信息"
Exit Sub
errLable:
MsgBox Err.Number + ":" + Err.Description, vbInformation + vbOKOnly, "错误信息"
Exit Sub
End Sub
<< 上一页 [11] [12] [13] [14] 下一页