发布网友 发布时间:2023-12-05 03:27
共2个回答
热心网友 时间:2024-08-17 01:44
Dim A() As String
Private Sub BEG_Click()
Timer1.Enabled = True
If BEG.Caption = "开始抽签" Then
BEG.Caption = "停止"
Else
BEG.Caption = "开始抽签"
Timer1.Enabled = False
End If
End Sub
Private Sub ADD_Click()
Dim STR As String
STR = InputBox("请输入要增加的名字")
Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim Str1 As String
Dim Str2 As String
Dim Str3 As String
Str1 = "Provider=Microsoft.Jet.OLEDB.4.0;"
Str2 = "Data Source=C:\Documents and Settings\Administrator\桌面\DB2.MDB;"
Str3 = "Jet OLEDB:Database Password="
conn.Open Str1 & Str2 & Str3
strSQL = "select * from 表1 "
rs.Open strSQL, conn, 3, 3
rs.AddNew
rs!名字 = STR
rs.Update
rs.Close
conn.Close
End Sub
Private Sub Form_Load()
Timer1.Enabled = False
Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim Str1 As String
Dim Str2 As String
Dim Str3 As String
Str1 = "Provider=Microsoft.Jet.OLEDB.4.0;"
Str2 = "Data Source=C:\Documents and Settings\Administrator\桌面\DB2.MDB;"
Str3 = "Jet OLEDB:Database Password="
conn.Open Str1 & Str2 & Str3
strSQL = "select * from 表1 "
rs.Open strSQL, conn, 3, 3
TEM = rs.RecordCount
rs.Close
For I = 1 To TEM
strSQL = "select * from 表1 where 编号=" & I & ""
rs.Open strSQL, conn, 3, 3
ReDim Preserve A(0 To I)
A(I) = rs!名字
rs.Close
Next I
conn.Close
End Sub
Private Sub Timer1_Timer()
Static J As Integer
Text1.Text = A(J)
J = J + 1
If J = UBound(A) Then
J = 1
End If
End Sub
代码以及运行过,你现在桌面上建立一个名为db2的数据库,一个字段“名字”
热心网友 时间:2024-08-17 01:40
抽签? 不就是RND函数吗?