主题:[讨论]小弟刚学几天,多多指教,数据查询问题
以这段代码产生的q值查询access数据库或者sql数据库中对应的id的数据(比如说这条数据有两个字段,name,gender),输入到txt文本里面
例如:q值,张三,男
q值,李四,女
Dim bStop As Boolean
Dim n(1 To 20), i, j, q
Private Sub Command1_Click()
'Dim j
Dim str As String
Command1.Visible = False
Randomize Timer
str = ""
Open "c:\vbt.txt" For Output As #1
While j < 2
q = Int(Rnd(1) * 20 + 1)
Label1.Caption = q: DoEvents: Sleep 125
If n(q) = 0 And bStop = True Then
str = str & q & Chr(13) & Chr(10)
n(q) = 1
j = j + 1
bStop = False
End If
Wend
If str <> "" Then
Print #1, str
End If
Close #1
End Sub
Private Sub Command2_Click()
bStop = True
End Sub
例如:q值,张三,男
q值,李四,女
Dim bStop As Boolean
Dim n(1 To 20), i, j, q
Private Sub Command1_Click()
'Dim j
Dim str As String
Command1.Visible = False
Randomize Timer
str = ""
Open "c:\vbt.txt" For Output As #1
While j < 2
q = Int(Rnd(1) * 20 + 1)
Label1.Caption = q: DoEvents: Sleep 125
If n(q) = 0 And bStop = True Then
str = str & q & Chr(13) & Chr(10)
n(q) = 1
j = j + 1
bStop = False
End If
Wend
If str <> "" Then
Print #1, str
End If
Close #1
End Sub
Private Sub Command2_Click()
bStop = True
End Sub