📄 inputstuplan.frm
字号:
VERSION 5.00
Begin VB.Form FrmInputStuPlan
BackColor = &H0000FFFF&
Caption = "输入招生计划"
ClientHeight = 3315
ClientLeft = 60
ClientTop = 450
ClientWidth = 5460
LinkTopic = "Form1"
LockControls = -1 'True
ScaleHeight = 3315
ScaleWidth = 5460
StartUpPosition = 2 '屏幕中心
Begin VB.Frame Frame1
BackColor = &H0000FFFF&
Height = 2895
Left = 120
TabIndex = 0
Top = 240
Width = 5055
Begin VB.CommandButton ResetCommand
Caption = "重 置"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1920
TabIndex = 9
Top = 2160
Width = 975
End
Begin VB.CommandButton CancelCommand
Caption = "取 消"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3600
TabIndex = 8
Top = 2160
Width = 975
End
Begin VB.CommandButton LoginCommand
Caption = "确 认"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 360
TabIndex = 7
Top = 2160
Width = 975
End
Begin VB.TextBox QuantityText
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1320
TabIndex = 6
Top = 1560
Width = 2665
End
Begin VB.TextBox ProvincesText
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1320
TabIndex = 4
Top = 960
Width = 2655
End
Begin VB.TextBox CollegeText
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1320
TabIndex = 2
Top = 240
Width = 2655
End
Begin VB.Label Label3
BackColor = &H0000FFFF&
Caption = "招生人数:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 240
TabIndex = 5
Top = 1680
Width = 1095
End
Begin VB.Label Label2
BackColor = &H0000FFFF&
Caption = "省份:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 720
TabIndex = 3
Top = 1080
Width = 735
End
Begin VB.Label Label1
BackColor = &H0000FFFF&
Caption = "院系:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 720
TabIndex = 1
Top = 360
Width = 855
End
End
End
Attribute VB_Name = "FrmInputStuPlan"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public MyConnection As ADODB.Connection
Public ConString As String
Private Sub ResetCommand_Click()
'置空所有TextBox
CollegeText.Text = ""
ProvincesText = ""
QuantityText = ""
End Sub
Private Sub LoginCommand_Click()
'先检测输入框是否为空,如为空,则提示用户
If CollegeText.Text = "" Or ProvincesText = "" Or QuantityText = "" Then
MsgBox "请正确输入信息后再加入招生计划表!", vbOKOnly + vbInformation, "注意"
Exit Sub
End If
'如果输入信息正确,则打开数据表添加数据
Dim rs_plan As New ADODB.Recordset
Dim sqlplan As String
sqlplan = "select * from StuAdmissionScheme"
rs_plan.CursorLocation = adUseClient
rs_plan.Open sqlplan, MyConnection, adOpenStatic, adLockPessimistic
rs_plan.AddNew
rs_plan.Fields("Colleges") = CollegeText.Text
rs_plan.Fields("Provinces") = ProvincesText
rs_plan.Fields("Quantity") = QuantityText
'要求用户确认是否确实要加入招生计划表
Dim an As String
an = MsgBox("确定要加入招生计划表吗?", vbYesNo, "")
If an = vbYes Then
rs_plan.Update
rs_plan.Close
MsgBox "加入信息成功!", vbOKOnly + vbInformation, "注意"
Else
rs_plan.CancelUpdate
rs_plan.Close
Exit Sub
End If
End Sub
Private Sub CancelCommand_Click()
Unload Me
End Sub
Private Sub Form_Load()
Set MyConnection = New ADODB.Connection
ConString = "Provider=MSDASQL.1;Persist Security Info=False;Data Source=Education_Maneger_System"
MyConnection.Open ConString
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -