vb写入ACCESS的问题
用VB编写随机程序抽取ACCESS表下的‘人员名单’,在按停止键后,LABLE上随机滚动的信息(如姓名等)停下来后怎么自动写入ACCESS表里的‘中奖名单’中。有哪位高手...
用VB编写随机程序抽取ACCESS表下的‘人员名单’,在按停止键后,LABLE上随机滚动的信息(如姓名等)停下来后怎么自动写入ACCESS表里的‘中奖名单’中。有哪位高手知道,请帮忙解答,谢谢!!
展开
展开全部
Dim cnn As New ADODB.Connection
'cnn.Open 自己写了.
Dim onRunning As Boolean
Private Sub Command1_Click()
onRunning = Not onRunning
If Not onRunning Then Exit Sub
Dim sql As String
sql = "select 姓名 from 人员名单 "
Dim rs As New ADODB.Recordset
rs.Open sql, cnn
rs.Close
Dim rows()
rows = rs.GetRows
Dim max As Integer
Dim n As Integer
max = UBound(rows, 2) + 1
Randomize
Do
n = Int(Rnd() * max)
Label1.Caption = rows(0, n)
DoEvents
Loop Until Not onRunning
sql = "select 姓名 from 中奖名单 where 姓名 ='" & rows(0, n) & "'"
rs.Open sql, cnn, adOpenKeyset, adLockOptimistic
If rs.EOF Then rs.AddNew
rs(0) = rows(0, n)
rs.Update
rs.Close
End Sub
'cnn.Open 自己写了.
Dim onRunning As Boolean
Private Sub Command1_Click()
onRunning = Not onRunning
If Not onRunning Then Exit Sub
Dim sql As String
sql = "select 姓名 from 人员名单 "
Dim rs As New ADODB.Recordset
rs.Open sql, cnn
rs.Close
Dim rows()
rows = rs.GetRows
Dim max As Integer
Dim n As Integer
max = UBound(rows, 2) + 1
Randomize
Do
n = Int(Rnd() * max)
Label1.Caption = rows(0, n)
DoEvents
Loop Until Not onRunning
sql = "select 姓名 from 中奖名单 where 姓名 ='" & rows(0, n) & "'"
rs.Open sql, cnn, adOpenKeyset, adLockOptimistic
If rs.EOF Then rs.AddNew
rs(0) = rows(0, n)
rs.Update
rs.Close
End Sub
2012-03-16
展开全部
中奖基本都是骗子软件
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询