PPT做抽奖系统!!!急!!请大家帮忙,在线等!!!解决了放100分
我要模拟抽奖系统,两个按钮一个Label或TextBox,点击开始按钮,就是让数据库中的号码不停地在窗体上多行滚动,点击停止按钮,就停下来。但不能重复抽!!!
在下是个菜鸟只能想到如下:
Dim CN As ADODB.Connection
Dim StartLoop As Boolean
Dim SqlStr As String
Private Sub Form_load()
CN.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\...\db1.mdb;Persist Security Info=False"
CN.Open
End Sub
Private Sub CommandButton1_Click()
Dim starTime As Single
Dim rs As ADODB.Recordset
StartLoop = True
SqlStr = "select call_no from pd_users where 1=1"
Set rs = CN.Execute(SqlStr)
rs.MoveFirst
Do While StartLoop
starTime = Timer
Do While Timer - starTime < 0.1
DoEvents
If StartLoop = False Then Exit Do
Loop
TextBox1 = rs("call_no")
rs.MoveNext
If rs.EOF Then rs.MoveFirst
Loop
rs.Close
End Sub
Private Sub CommandButton2_Click()
StartLoop = False
End Sub
系统提示是连接问题,请大家帮忙看看,并着上面所说完善,小弟万分感谢!!