📄 frmtianxiekaoshixinxi.frm
字号:
VERSION 5.00
Begin VB.Form frmtianxiekaoshixinxi
BorderStyle = 1 'Fixed Single
Caption = "填写考试信息"
ClientHeight = 5805
ClientLeft = 45
ClientTop = 375
ClientWidth = 7470
ControlBox = 0 'False
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 5805
ScaleWidth = 7470
Begin VB.PictureBox Picture1
Height = 2655
Left = 240
Picture = "frmtianxiekaoshixinxi.frx":0000
ScaleHeight = 2595
ScaleWidth = 2715
TabIndex = 9
Top = 360
Width = 2775
End
Begin VB.Timer Timer1
Interval = 100
Left = 1320
Top = 3240
End
Begin VB.CommandButton Command2
Caption = "开始答题"
Default = -1 'True
Height = 615
Left = 2040
TabIndex = 2
Top = 4800
Width = 3255
End
Begin VB.CommandButton Command1
Caption = "提交考场号"
Height = 615
Left = 2040
TabIndex = 1
Top = 4800
Width = 3255
End
Begin VB.Frame Frame1
Height = 1095
Left = 240
TabIndex = 3
Top = 3000
Width = 6975
Begin VB.TextBox Text1
Height = 375
Left = 3720
TabIndex = 0
Top = 360
Width = 3015
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "请填写考场号:"
Height = 180
Left = 2040
TabIndex = 4
Top = 480
Width = 1260
End
End
Begin VB.Label Label9
AutoSize = -1 'True
Caption = "结束时间为:"
Height = 180
Left = 3960
TabIndex = 13
Top = 4320
Width = 1080
End
Begin VB.Label Label8
AutoSize = -1 'True
Caption = "开始时间为:"
Height = 180
Left = 240
TabIndex = 12
Top = 4320
Width = 1080
End
Begin VB.Label Label7
AutoSize = -1 'True
Caption = "Label6"
Height = 180
Left = 1320
TabIndex = 11
Top = 4320
Width = 540
End
Begin VB.Label Label6
AutoSize = -1 'True
Caption = "Label6"
Height = 180
Left = 5040
TabIndex = 10
Top = 4320
Width = 540
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "当前时间为:"
Height = 180
Left = 3480
TabIndex = 8
Top = 2040
Width = 1080
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "Label4"
ForeColor = &H000000FF&
Height = 180
Left = 4800
TabIndex = 7
Top = 2040
Width = 540
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "本科开考时间为:"
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Left = 3120
TabIndex = 6
Top = 120
Width = 2040
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "开考时间"
BeginProperty Font
Name = "楷体_GB2312"
Size = 21.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 435
Left = 3120
TabIndex = 5
Top = 1080
Width = 1860
End
End
Attribute VB_Name = "frmtianxiekaoshixinxi"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Private Sub Command1_Click()
If Text1.Text <> "" Then
Dim kssj As String
Dim strsql1 As String
If rs.State = adStateOpen Then rs.Close
strsql1 = "select 开考时间 from kaochangxinxi where 考场号='" & Text1.Text & "'"
rs.Open strsql1, conn, adOpenStatic, adLockReadOnly
If rs.RecordCount = 0 Then '不存在指定编号的用户信息
MsgBox "该考场号不存在", vbExclamation + vbOKOnly, "操作提示"
Exit Sub
End If
kssj = rs.Fields(0).Value
Label3.Caption = kssj
Dim kssj2 As String
Dim strsql2 As String
If rs.State = adStateOpen Then rs.Close
strsql2 = "select 结束时间 from kaochangxinxi where 考场号='" & Text1.Text & "'"
rs.Open strsql2, conn, adOpenStatic, adLockReadOnly
kssj2 = rs.Fields(0).Value
Label6.Caption = kssj2
frmmain.jieshushijian = Label6.Caption
Dim kssj3 As String
Dim strsql3 As String
If rs.State = adStateOpen Then rs.Close
strsql3 = "select 开考时间 from kaochangxinxi where 考场号='" & Text1.Text & "'"
rs.Open strsql3, conn, adOpenStatic, adLockReadOnly
kssj3 = rs.Fields(0).Value
Label7.Caption = kssj3
frmmain.kaishishijian = Label7.Caption
Label2.Caption = "本科考试开考时间为:"
Command1.Visible = False
Command2.Visible = True
Command2.Enabled = False
If Label4.Caption >= Label3.Caption Then
Command2.Enabled = True
End If
Else
MsgBox "请输入考场号", vbOKOnly
Text1.Text = ""
Text1.SetFocus
End If
End Sub
Private Sub Command2_Click()
frmmain.填写考生信息.Enabled = False
frmmain.Toolbar2.Buttons(1).Enabled = False
frmmain.kaochanghao = Text1.Text
Randomize
frmmain.test = Int(Rnd * 16) + 1
Dim Hay As Object
'打开WORD
Set Hay = CreateObject("Word.Application")
'没有下面一句,就是打开了也看不到
Hay.Visible = True
'让WORD打开你想看的文件
Hay.Documents.Open FileName:="c:\test\《SQL数据库管理与开发》试题(" & frmmain.test & "卷).doc"
'加下面这句试试
Hay.Activate
frmkaishidati.Show
frmjieshushijian.Show
Unload Me
End Sub
Private Sub Form_Load()
Label2.Caption = "登录时间为:"
Command2.Visible = False
Label3.Caption = Now()
conn.CursorLocation = adUseClient
conn.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Roso;Data Source=(local)"
conn.Open
End Sub
Private Sub Form_Unload(Cancel As Integer)
rs.Close
Set rs = Nothing
conn.Close
Set conn = Nothing
Set frmtianxiekaoshixinxi = Nothing
End Sub
Private Sub Timer1_Timer()
Timer1.Enabled = True
Label4.Caption = Now()
If Label4.Caption >= Label3.Caption Then
Command2.Enabled = True
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -