📄 frmaddstudent.frm
字号:
VERSION 5.00
Begin VB.Form FrmAddStudent
Caption = "添加学生信息"
ClientHeight = 5445
ClientLeft = 60
ClientTop = 345
ClientWidth = 8145
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 5445
ScaleWidth = 8145
StartUpPosition = 1 '所有者中心
Begin VB.PictureBox Picture1
DataField = "photo"
DataSource = "Data1"
Height = 1500
Left = 225
ScaleHeight = 1440
ScaleWidth = 1575
TabIndex = 13
Top = 3870
Visible = 0 'False
Width = 1635
End
Begin VB.CommandButton Command1
Caption = "浏览"
Height = 285
Left = 6660
TabIndex = 12
Top = 3105
Width = 645
End
Begin VB.Data Data1
Caption = "Data1"
Connect = "Access"
DatabaseName = "F:\My Documents\VB\考试管理系统\服务器\exmext.dll"
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 375
Left = 2880
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = "Student"
Top = 4860
Visible = 0 'False
Width = 2220
End
Begin VB.CommandButton Command2
Caption = "入库"
Height = 375
Index = 0
Left = 2970
TabIndex = 11
Top = 4185
Width = 1320
End
Begin VB.PictureBox CDlg
Height = 480
Left = 6795
ScaleHeight = 420
ScaleWidth = 1140
TabIndex = 14
Top = 2565
Width = 1200
End
Begin VB.Frame Frame1
Height = 60
Left = 270
TabIndex = 10
Top = 990
Width = 7485
End
Begin VB.CommandButton Command2
Caption = "取消"
Height = 375
Index = 1
Left = 4365
TabIndex = 9
Top = 4185
Width = 1320
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
Height = 330
Index = 3
Left = 2340
TabIndex = 7
Top = 3150
Width = 2085
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
Height = 330
Index = 2
Left = 2340
TabIndex = 5
Top = 2610
Width = 2085
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
Height = 330
Index = 1
Left = 2340
TabIndex = 3
Top = 2070
Width = 2085
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
Height = 330
Index = 0
Left = 2340
TabIndex = 1
Top = 1530
Width = 2085
End
Begin VB.Image Image1
BorderStyle = 1 'Fixed Single
Height = 1860
Left = 4995
Picture = "FrmAddStudent.frx":0000
Stretch = -1 'True
Top = 1575
Width = 1500
End
Begin VB.Image Image2
Height = 660
Left = 405
Picture = "FrmAddStudent.frx":0442
Stretch = -1 'True
Top = 135
Width = 615
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "照片"
Height = 180
Left = 4590
TabIndex = 8
Top = 1620
Width = 360
End
Begin VB.Label Label1
Caption = "考生性别:"
Height = 330
Index = 3
Left = 1395
TabIndex = 6
Top = 3195
Width = 1320
End
Begin VB.Label Label1
Caption = "姓名:"
Height = 330
Index = 2
Left = 1395
TabIndex = 4
Top = 2610
Width = 1320
End
Begin VB.Label Label1
Caption = "班级:"
Height = 330
Index = 1
Left = 1395
TabIndex = 2
Top = 2070
Width = 1320
End
Begin VB.Label Label1
Caption = "准考证号:"
Height = 330
Index = 0
Left = 1395
TabIndex = 0
Top = 1575
Width = 1320
End
End
Attribute VB_Name = "FrmAddStudent"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
CDlg.FileName = ""
CDlg.ShowOpen
If CDlg.FileName <> "" Then
Image1.Picture = LoadPicture(CDlg.FileName)
End If
End Sub
Private Sub Command2_Click(Index As Integer)
Dim rsq As ADODB.Recordset
Dim qMsg$
Dim SQL$
Select Case Index
Case 0
For i = 0 To 3
If Text1(i).Text = Empty Then
MsgBox "请填写完整信息", vbInformation, "提示"
Text1(i).SetFocus
Exit Sub
End If
Next i
DBName = StudentDB
SQL = "select * from Student Where ID= '" & Text1(0).Text & "'"
Set rsq = executeSQL(SQL, qMsg, DBName)
If qMsg = "查询正确" Then
MsgBox "已经有此考生", vbInformation, "提示"
Set rsq = Nothing
Exit Sub
End If
Data1.Recordset.AddNew
Picture1.Picture = Image1.Picture
Data1.Recordset.Fields(0) = Text1(0).Text
Data1.Recordset.Fields(1) = Text1(1).Text
Data1.Recordset.Fields(2) = Text1(2).Text
Data1.Recordset.Fields(3) = Text1(3).Text
Data1.Recordset.Update
If MsgBox("考生添加成功,是否继续添加", vbInformation + vbYesNo, "成功") = vbYes Then
For i = 0 To 3
Text1(i).Text = Empty
Next i
Image1.Picture = Picture1.Picture
Else
Unload Me
End If
Case 1
Me.Hide
End Select
End Sub
Private Sub Form_Load()
Data1.DatabaseName = App.Path & "\" & StudentDB
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -