📄 form9.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"
Begin VB.Form Form9
ClientHeight = 4845
ClientLeft = 60
ClientTop = 450
ClientWidth = 7620
LinkTopic = "Form9"
ScaleHeight = 4845
ScaleWidth = 7620
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command4
Caption = "查看出题结果"
Height = 375
Left = 4920
TabIndex = 11
Top = 3480
Width = 2055
End
Begin VB.CommandButton Command3
Caption = "按章节选择"
Enabled = 0 'False
Height = 375
Left = 5880
TabIndex = 10
Top = 1320
Width = 1455
End
Begin VB.CommandButton Command2
Caption = "按科目选择"
Height = 375
Left = 2280
TabIndex = 6
Top = 1320
Width = 1455
End
Begin VB.CommandButton Command1
Caption = "自动出题"
Height = 375
Left = 4920
TabIndex = 5
Top = 2880
Width = 2055
End
Begin VB.TextBox Text1
Height = 375
Left = 2640
TabIndex = 0
Text = "4"
Top = 2880
Width = 1575
End
Begin MSAdodcLib.Adodc Adodc3
Height = 375
Left = 840
Top = 4080
Visible = 0 'False
Width = 1200
_ExtentX = 2117
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 2
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=kygl.mdb;Persist Security Info=False"
OLEDBString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=kygl.mdb;Persist Security Info=False"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "km"
Caption = "浏览记录"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin MSDataListLib.DataCombo DataCombo2
Bindings = "Form9.frx":0000
DataField = "科目"
DataSource = "Adodc1"
Height = 330
Left = 840
TabIndex = 7
Top = 1320
Width = 1095
_ExtentX = 1931
_ExtentY = 582
_Version = 393216
ListField = "科目"
Text = ""
End
Begin MSDataListLib.DataCombo DataCombo3
Bindings = "Form9.frx":0015
DataField = "章"
DataSource = "Adodc1"
Height = 330
Left = 4200
TabIndex = 8
Top = 1320
Width = 1095
_ExtentX = 1931
_ExtentY = 582
_Version = 393216
ListField = "章"
Text = ""
End
Begin MSDataListLib.DataCombo DataCombo4
Bindings = "Form9.frx":002A
DataField = "节"
DataSource = "Adodc1"
Height = 330
Left = 4200
TabIndex = 9
Top = 1800
Width = 1095
_ExtentX = 1931
_ExtentY = 582
_Version = 393216
ListField = "节"
Text = ""
End
Begin MSAdodcLib.Adodc Adodc4
Height = 375
Left = 3120
Top = 4080
Visible = 0 'False
Width = 1200
_ExtentX = 2117
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 2
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=kygl.mdb;Mode=Read|Write;Persist Security Info=False"
OLEDBString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=kygl.mdb;Mode=Read|Write;Persist Security Info=False"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "zhang"
Caption = "浏览记录"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin MSAdodcLib.Adodc Adodc5
Height = 375
Left = 5160
Top = 4080
Visible = 0 'False
Width = 1200
_ExtentX = 2117
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 2
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=kygl.mdb;Persist Security Info=False"
OLEDBString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=kygl.mdb;Persist Security Info=False"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "jie"
Caption = "浏览记录"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.Label Label4
Caption = "输入要出的题目数:"
Height = 255
Left = 720
TabIndex = 4
Top = 3000
Width = 1815
End
Begin VB.Label Label3
Caption = "条记录"
Height = 255
Left = 3120
TabIndex = 3
Top = 240
Width = 855
End
Begin VB.Label Label2
BeginProperty Font
Name = "宋体"
Size = 15.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 495
Left = 2040
TabIndex = 2
Top = 120
Width = 855
End
Begin VB.Label Label1
Caption = "当前选择共有:"
Height = 255
Left = 600
TabIndex = 1
Top = 240
Width = 1335
End
End
Attribute VB_Name = "Form9"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim s1 As String
Private Sub Command1_Click()
If Trim(Text1.Text) = "" Then
MsgBox "输出题目不能为空"
Exit Sub
End If
If CInt(Text1.Text) > CInt(Label2.Caption) Then
MsgBox "输出题目不能大于所有题目"
Exit Sub
End If
If CInt(Text1.Text) <= 0 Then
MsgBox "输出题目不能为零"
Exit Sub
End If
Dim mycn As New ADODB.Connection
Dim myrs As New ADODB.Recordset
Set myrs = New ADODB.Recordset
Dim myrs2 As New ADODB.Recordset
Set myrs2 = New ADODB.Recordset
Dim myrs3 As New ADODB.Recordset
Set myrs3 = New ADODB.Recordset
mycn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=kygl.mdb;"
myrs.open "delete from tkgl2 ", mycn, adOpenKeyset, adLockOptimistic
s2 = "insert into tkgl2 " & s1
myrs.open s2, mycn, adOpenKeyset, adLockOptimistic
myrs2.open "delete from sj", mycn, adOpenKeyset, adLockOptimistic
j = Text1.Text
myrs3.open "select * from tkgl2 ", mycn, adOpenKeyset, adLockOptimistic
Label2.Caption = CStr(myrs3.RecordCount())
'''''''''''''''''''''''''''''''''''''''''''''''''''''''
For i = 1 To j
nb = myrs3.RecordCount
rdnb = Int((nb) * Rnd()) '获得随机数
myrs3.Move rdnb
t1 = CStr(myrs3("编号"))
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
myrs2.open "insert into sj select * from tkgl2 where 编号='" + t1 + "' ", mycn, adOpenKeyset, adLockOptimistic
myrs3.Delete
myrs3.MoveFirst
Next
End Sub
Private Sub Command2_Click()
tt = DataCombo2.Text
s1 = "select * from tkgl where 科目='" + tt + "' "
Dim mycn As New ADODB.Connection
Dim myrs As New ADODB.Recordset
Set myrs = New ADODB.Recordset
mycn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=kygl.mdb;"
myrs.open s1, mycn, adOpenKeyset, adLockOptimistic
Label2.Caption = CStr(myrs.RecordCount())
Command3.Enabled = True
End Sub
Private Sub Command3_Click()
tt = DataCombo2.Text
tt2 = DataCombo3.Text
tt3 = DataCombo4.Text
s1 = "select * from tkgl where 科目='" + tt + "' and 章='" + tt2 + "' and 节='" + tt3 + "' "
Dim mycn As New ADODB.Connection
Dim myrs As New ADODB.Recordset
Set myrs = New ADODB.Recordset
mycn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=kygl.mdb;"
myrs.open s1, mycn, adOpenKeyset, adLockOptimistic
Label2.Caption = CStr(myrs.RecordCount())
End Sub
Private Sub Command4_Click()
Form10.Show
End Sub
Private Sub Form_Load()
Dim mycn As New ADODB.Connection
Dim myrs As New ADODB.Recordset
Set myrs = New ADODB.Recordset
mycn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=kygl.mdb;"
myrs.open "select * from tkgl ", mycn, adOpenKeyset, adLockOptimistic
Label2.Caption = CStr(myrs.RecordCount())
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -