Dim tArray() As Long
Dim tArrayCount As Long
Dim tIndex As Long
Dim tDesIndex As Long
Dim tTempValue As Long
获数组tArray……
For tIndex=1 To tArrayCount
tTempValue=tArray(tIndex)
tDesIndex=Int(Rnd*tArrayCount)
tArray(tIndex)=tArray(tDesIndex)
tArray(tDesIndex)=tTempValue
Next
For X=0 To N
DataSwap F(X),F(Int(Rnd*(N+1)))'将第X个索引(或者题域内的题目)与随机个索引(或者题域内的题目)交换,从0到第N个元素则为不重复乱序。如果为了追求速度,N可以不是题域内题目全体数量,只要是你需要的数目就可以。因为0到第N个元素必定为不重复乱序。
Next
你要的是查询语句吧.
任意条件查询:
private sub sqlselect
strtiaojian = ""
Set db = New Connection
db.CursorLocation = adUseClient
db.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=data.mdb;Persist Security Info=False;"
Set RS = New Recordset
Call tiaojian
strsql = "select ID,姓名,性别,出生日期 from table1 where " & strtiaojian
If strtiaojian = "" Then
strsql = Left(strsql, Len(strsql) - 7)
End If
end sub
private Sub tiaojian()
If name.Text <> "" Then
strtiaojian = strtiaojian & "姓名='" & name.Text & "' and "
End If
If xingbie.Text <> "" Then
strtiaojian = strtiaojian & "性别='" & xingbie.Text & "' and "
End If
If Len(strtiaojian) > 0 Then
strtiaojian = Left(strtiaojian, Len(strtiaojian) - 5)
End If
End Sub