📄 frmaddstudent.frm
字号:
VERSION 5.00
Begin VB.Form FrmAddStudent
BackColor = &H00FFC0C0&
Caption = "输入学生资料"
ClientHeight = 6960
ClientLeft = 60
ClientTop = 420
ClientWidth = 4995
LinkTopic = "Form2"
ScaleHeight = 6960
ScaleWidth = 4995
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton cmdReset
Caption = "清空所有"
Height = 495
Left = 3600
TabIndex = 27
Top = 6240
Width = 1215
End
Begin VB.CommandButton cmdCancel
Caption = "取消"
Height = 495
Left = 1920
TabIndex = 26
Top = 6240
Width = 1215
End
Begin VB.CommandButton cmdOk
Caption = "确定"
Height = 495
Left = 120
TabIndex = 25
Top = 6240
Width = 1215
End
Begin VB.TextBox txtMemo
BackColor = &H00FFFFFF&
Height = 1215
Left = 240
MultiLine = -1 'True
TabIndex = 24
Top = 4440
Width = 4575
End
Begin VB.Frame Frame2
BackColor = &H00FFC0C0&
Caption = "备注"
Height = 1575
Left = 120
TabIndex = 23
Top = 4200
Width = 4815
End
Begin VB.TextBox txtBirthday
BackColor = &H80000009&
Height = 300
Left = 3480
TabIndex = 22
Top = 2160
Width = 1215
End
Begin VB.ComboBox cmbSex
BackColor = &H80000009&
Height = 300
ItemData = "FrmAddStudent.frx":0000
Left = 960
List = "FrmAddStudent.frx":000A
TabIndex = 21
Top = 1680
Width = 1215
End
Begin VB.TextBox txtName
BackColor = &H80000009&
Height = 300
Left = 960
TabIndex = 20
Top = 720
Width = 1215
End
Begin VB.TextBox txtDepartment
BackColor = &H80000009&
Height = 300
Left = 960
TabIndex = 19
Top = 1200
Width = 1215
End
Begin VB.TextBox txtNative
BackColor = &H80000009&
Height = 300
Left = 960
TabIndex = 18
Top = 2160
Width = 1215
End
Begin VB.TextBox txtPhone
BackColor = &H80000009&
Height = 300
Left = 960
TabIndex = 17
Top = 2640
Width = 1215
End
Begin VB.TextBox txtAddress
BackColor = &H80000009&
Height = 300
Left = 960
TabIndex = 16
Top = 3120
Width = 3735
End
Begin VB.TextBox txtEmail
BackColor = &H00FFFFFF&
Height = 300
Left = 960
TabIndex = 15
Top = 3600
Width = 3735
End
Begin VB.TextBox txtClass
BackColor = &H80000009&
Height = 300
Left = 3480
TabIndex = 14
Top = 1200
Width = 1215
End
Begin VB.TextBox txtZipcode
BackColor = &H80000009&
Height = 300
Left = 3480
TabIndex = 13
Top = 2640
Width = 1215
End
Begin VB.TextBox txtID
BackColor = &H80000009&
Height = 300
Left = 960
TabIndex = 12
Top = 240
Width = 1215
End
Begin VB.Frame Frame1
BackColor = &H00FFC0C0&
Caption = "个人信息"
Height = 5895
Left = 0
TabIndex = 0
Top = 0
Width = 5055
Begin VB.Label Label4
BackColor = &H00FFC0C0&
Caption = "邮编:"
Height = 495
Left = 2760
TabIndex = 8
Top = 2640
Width = 1215
End
Begin VB.Label Label6
BackColor = &H00FFC0C0&
Caption = "E_MAIL:"
Height = 495
Left = 120
TabIndex = 6
Top = 3720
Width = 1215
End
Begin VB.Label Label5
BackColor = &H00FFC0C0&
Caption = "地址:"
Height = 495
Left = 120
TabIndex = 7
Top = 3240
Width = 1215
End
Begin VB.Label Label2
BackColor = &H00FFC0C0&
Caption = "电话:"
Height = 495
Left = 120
TabIndex = 10
Top = 2640
Width = 1215
End
Begin VB.Label Label1
BackColor = &H00FFC0C0&
Caption = "籍贯:"
Height = 495
Left = 120
TabIndex = 11
Top = 2160
Width = 1215
End
Begin VB.Label Label3
BackColor = &H00FFC0C0&
Caption = "生日:"
Height = 495
Left = 2760
TabIndex = 9
Top = 2160
Width = 1215
End
Begin VB.Label Label7
BackColor = &H00FFC0C0&
Caption = "班级:"
Height = 495
Left = 2760
TabIndex = 5
Top = 1200
Width = 1215
End
Begin VB.Label Label8
BackColor = &H00FFC0C0&
Caption = "性别:"
Height = 495
Left = 120
TabIndex = 4
Top = 1680
Width = 1215
End
Begin VB.Label Label9
BackColor = &H00FFC0C0&
Caption = "系别:"
Height = 495
Left = 120
TabIndex = 3
Top = 1200
Width = 1215
End
Begin VB.Label Label10
BackColor = &H00FFC0C0&
Caption = "姓名:"
Height = 495
Left = 120
TabIndex = 2
Top = 720
Width = 1215
End
Begin VB.Label Label11
BackColor = &H00FFC0C0&
Caption = "学号:"
Height = 495
Left = 120
TabIndex = 1
Top = 240
Width = 1215
End
End
End
Attribute VB_Name = "FrmAddStudent"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim strCnn As String
Dim cnn As New ADODB.Connection
Dim cmd As New ADODB.Command
Public strStuNO As String
Private Sub CmdCancel_Click()
Unload Me
End Sub
Private Sub cmdOk_Click()
Append
'reset
End Sub
Private Sub cmdReset_Click()
reset
End Sub
Private Sub Form_Load()
strCnn = "Provider=SQLOLEDB.1;Integrated Security=SSPI; Persist Security Info=False;User ID=sa;Initial Catalog=学生信息管理系统;Data Source=飞扬社区"
cnn.Open strCnn
End Sub
Private Sub Form_Unload(Cancel As Integer)
cnn.Close
Set cnn = Nothing
End Sub
Private Sub Append()
On Error GoTo ErrHandle
Dim rs As New ADODB.Recordset
cmd.ActiveConnection = cnn
cmd.CommandType = adCmdStoredProc
cmd.CommandText = "stu_AddBasicStudentInfo"
cmd.Parameters.Append cmd.CreateParameter("@studentNO", adChar, adParamInput, 6)
cmd.Parameters.Append cmd.CreateParameter("@name", adVarChar, adParamInput, 20)
cmd.Parameters.Append cmd.CreateParameter("@sex", adChar, adParamInput, 2)
cmd.Parameters.Append cmd.CreateParameter("@departName", adVarChar, adParamInput, 50)
cmd.Parameters.Append cmd.CreateParameter("@className", adVarChar, adParamInput, 50)
cmd.Parameters.Append cmd.CreateParameter("@birthday", adDate, adParamInput)
cmd.Parameters.Append cmd.CreateParameter("@native", adVarChar, adParamInput, 50)
cmd.Parameters.Append cmd.CreateParameter("@phone", adChar, adParamInput, 20)
cmd.Parameters.Append cmd.CreateParameter("@address", adVarChar, adParamInput, 100)
cmd.Parameters.Append cmd.CreateParameter("@zipCode", adChar, adParamInput, 8)
cmd.Parameters.Append cmd.CreateParameter("@email", adVarChar, adParamInput, 50)
cmd.Parameters.Append cmd.CreateParameter("@memo", adVarChar, adParamInput, 1000)
cmd.Parameters.Refresh
cmd.Parameters("@studentNO").Value = txtID.Text
cmd.Parameters("@name").Value = txtName.Text
cmd.Parameters(3).Value = cmbSex.Text
cmd.Parameters(4).Value = txtDepartment.Text
cmd.Parameters(5).Value = txtClass.Text
cmd.Parameters(6).Value = txtBirthday.Text
cmd.Parameters(7).Value = txtNative.Text
cmd.Parameters(8).Value = txtPhone.Text
cmd.Parameters(9).Value = txtAddress.Text
cmd.Parameters(10).Value = txtZipcode.Text
cmd.Parameters(11).Value = txtEmail.Text
cmd.Parameters(12).Value = txtMemo.Text
Set rs.Source = cmd
rs.Open
Set rs = cmd.Execute()
MsgBox "添加成功!"
Exit Sub
ErrHandle:
MsgBox Err.Description
End Sub
Private Sub reset()
txtID.Text = ""
txtName.Text = ""
cmbSex.Text = "男"
txtDepartment.Text = ""
txtClass.Text = ""
txtBirthday.Text = ""
txtNative.Text = ""
txtPhone.Text = ""
txtAddress.Text = ""
txtZipcode.Text = ""
txtEmail.Text = ""
txtMemo.Text = ""
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -