📄 form2.frm
字号:
VERSION 5.00
Begin VB.Form Form2
Caption = """计算机基础""上机考试系统 "
ClientHeight = 4350
ClientLeft = 60
ClientTop = 390
ClientWidth = 8085
BeginProperty Font
Name = "宋体"
Size = 21.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form2"
ScaleHeight = 4350
ScaleWidth = 8085
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Command2
Caption = "退出"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 6360
TabIndex = 6
Top = 3000
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "验证"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 6360
TabIndex = 5
Top = 2040
Width = 1095
End
Begin VB.TextBox txtPwd
DataField = "考生姓名"
DataSource = "Adodc1"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 2160
TabIndex = 4
Top = 2880
Width = 2895
End
Begin VB.TextBox txtUser
DataField = "准考证号"
DataSource = "Adodc1"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 2160
TabIndex = 2
Top = 1920
Width = 2895
End
Begin VB.Label Label3
Caption = "考生姓名"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 600
TabIndex = 3
Top = 3120
Width = 975
End
Begin VB.Label Label2
Caption = "准考证号"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 600
TabIndex = 1
Top = 2160
Width = 1095
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "Word操作部分"
BeginProperty Font
Name = "宋体"
Size = 36
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 855
Left = 1680
TabIndex = 0
Top = 480
Width = 4695
End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim step1 As Integer
Dim strCnn As String
Dim rs1 As New ADODB.Recordset
Dim cnn As ADODB.Connection
Private Sub Command1_Click()
username = ""
If txtUser.Text = "" Then
MsgBox "准考证号不能空,请输入!", vbOKOnly + vbExclamation, "警告"
txtUser.SetFocus
Else
Set cnn = New ADODB.Connection
'打开连接
cnn.Open strCnn
rs1.Open "select * from 登陆情况 where 准考证号='" + txtUser.Text + "'", cnn, adOpenKeyset, adLockOptimistic
If rs1.RecordCount = 0 Then
MsgBox "没有这个考生,请重新输入准考证号!", vbOKOnly + vbExclamation, "警告"
txtUser.SetFocus
rs1.Close
Else
If txtPwd.Text = "" Then
MsgBox "考生姓名不能空,请重新输入!", vbOKOnly + vbExclamation, "警告"
txtPwd.SetFocus
txtPwd.Text = ""
rs1.Close
ElseIf Trim(rs1.Fields(1)) = Trim(txtPwd.Text) Then
MsgBox "验证成功,进入考试系统!", vbOKOnly + vbExclamation, "提示"
Me.Hide
Form3.Show
username = Trim(txtUser.Text)
rs1.Close
Else
MsgBox "输入准考证号与考生姓名不匹配,请重新输入!", vbOKOnly + vbExclamation, "警告"
txtPwd.SetFocus
txtPwd.Text = ""
rs1.Close
End If
End If
End If
End Sub
Private Sub Command2_Click()
Unload Me
Form1.Show
End Sub
Private Sub Form_Load()
strCnn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=登陆情况.mdb;Persist Security Info=False"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -