谁能提供抽奖程序的代码。

zbboy80 2003-10-15 11:46:06
要求:随机抽取几个身份证号,分别为一等奖1名,二等奖2名,三等奖3名...
谁提供的资料多,我就大大的给分啊!
...全文
75 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
zbboy80 2003-10-16
  • 打赏
  • 举报
回复
没有什么规则,只要身份证不重复就行了。
lihandong 2003-10-16
  • 打赏
  • 举报
回复
关注!
阿建像熊猫 2003-10-16
  • 打赏
  • 举报
回复
帮你UP一下.
online 2003-10-16
  • 打赏
  • 举报
回复
以前做的
Private Sub cmdBegin_Click()
Dim Rs As ADODB.Recordset
Set Rs = New ADODB.Recordset
'If strFilePath = "" Then
' MsgBox "请先选择一个数据库文件! ", vbInformation + vbOKOnly, "提示信息"
' Exit Sub
'End If
If IntTotalPersonCount < 1 Then
MsgBox "目前注册用户为零不能进行抽奖! ", vbInformation + vbOKOnly, "提示信息"
Exit Sub
End If

If cmdBegin.Caption = "开始" Then


' Timer1.Enabled = True
cmdBegin.Caption = "停止"
cmdOK.Enabled = False
cmdCancel.Enabled = False
cmdBegin.SetFocus
End If
Dim j As Integer
Dim RstSQL As New ADODB.Recordset
Dim RndNumber As Integer
For j = 1 To 20 '如果一等奖1名 就是for j=1 to 1
flag = False
Randomize
RndNumber = Int(IntTotalPersonCount * Rnd + 1)

Rs.open "select count(*) as ll from temp1 WHERE Person_ID=" & RndNumber, CnnDSN, 1, 3
If Rs.Fields("ll") = 0 Then
'如果没有,则将抽取的人员插入到temp1表中
CnnDSN.Execute ("insert into temp1(Person_ID,Invoice_ID,Person_Name,Person_Tel,Checked,vl) SELECT Person_ID,Invoice_ID,Person_Name,Person_Tel,Checked,vl from Lottery_Table WHERE Person_ID=" & RndNumber)
Else
'保证每次必须抽取一个人
Do While flag = False
Randomize
RndNumber = Int(IntTotalPersonCount * Rnd + 1)

Rs.Close
Rs.open "select count(*) as ll from temp1 WHERE Person_ID=" & RndNumber, CnnDSN, 1, 3
If Rs.Fields("ll") = 0 Then
'如果没有,则将抽取的人员插入到temp1表中
CnnDSN.Execute ("insert into temp1(Person_ID,Invoice_ID,Person_Name,Person_Tel,Checked,vl) SELECT Person_ID,Invoice_ID,Person_Name,Person_Tel,Checked,vl from Lottery_Table WHERE Person_ID=" & RndNumber)
flag = True
End If

Loop
End If
Rs.Close
Next

cmdBegin.Caption = "开始"


Adodc1.CommandType = adCmdText
Adodc1.ConnectionString = CnnDSN
Adodc1.RecordSource = "SELECT Person_ID as 人员编号,Invoice_ID AS 身份证号,Person_Name as 姓名,Person_Tel as 电话 FROM temp1"

Set DataGrid1.DataSource = Adodc1
Adodc1.Refresh

End Sub
happymingnan 2003-10-16
  • 打赏
  • 举报
回复
学习
Gelim 2003-10-15
  • 打赏
  • 举报
回复
详细的规则是什么啊?

7,763

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧