📄 frmsadd.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form Form1
BackColor = &H00FFC0FF&
BorderStyle = 1 'Fixed Single
Caption = "登记"
ClientHeight = 6990
ClientLeft = 45
ClientTop = 330
ClientWidth = 6480
LinkTopic = "Form1"
MDIChild = -1 'True
ScaleHeight = 6990
ScaleWidth = 6480
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 4440
Top = 240
Visible = 0 'False
Width = 1215
_ExtentX = 2143
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = "he"
Password = "he"
RecordSource = ""
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.Frame Frame1
BackColor = &H00FFC0FF&
Caption = "学生档案设置"
Height = 5415
Left = 240
TabIndex = 4
Top = 1080
Width = 5415
Begin VB.ComboBox Combo2
Height = 300
Left = 2160
TabIndex = 21
Top = 2040
Width = 1215
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
BackColor = &H80000018&
ForeColor = &H000000FF&
Height = 420
Index = 6
Left = 2160
MaxLength = 5
TabIndex = 19
Top = 4320
Width = 1575
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
BackColor = &H80000018&
ForeColor = &H000000FF&
Height = 420
IMEMode = 3 'DISABLE
Index = 5
Left = 2160
MaxLength = 21
PasswordChar = "*"
TabIndex = 16
Top = 3720
Width = 1575
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 390
Left = 840
TabIndex = 7
TabStop = 0 'False
Top = 4920
Width = 1095
End
Begin VB.CommandButton Command2
Caption = "返回"
Height = 390
Left = 3360
TabIndex = 6
TabStop = 0 'False
Top = 4920
Width = 1095
End
Begin VB.ComboBox Combo1
BackColor = &H80000018&
ForeColor = &H000000FF&
Height = 300
Index = 0
ItemData = "Frmsadd.frx":0000
Left = 2160
List = "Frmsadd.frx":000A
TabIndex = 5
TabStop = 0 'False
Top = 1440
Width = 1215
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
BackColor = &H80000018&
ForeColor = &H000000FF&
Height = 420
Index = 0
Left = 2160
MaxLength = 5
TabIndex = 0
Top = 240
Width = 1215
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
BackColor = &H80000018&
ForeColor = &H000000FF&
Height = 420
Index = 1
Left = 2160
MaxLength = 8
TabIndex = 1
Top = 840
Width = 1215
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
BackColor = &H80000018&
ForeColor = &H000000FF&
Height = 420
Index = 3
Left = 2160
MaxLength = 30
TabIndex = 2
Top = 2520
Width = 1575
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
BackColor = &H80000018&
ForeColor = &H000000FF&
Height = 420
IMEMode = 3 'DISABLE
Index = 4
Left = 2160
MaxLength = 21
PasswordChar = "*"
TabIndex = 3
Top = 3120
Width = 1575
End
Begin VB.Label Label6
BackColor = &H00FFC0FF&
Caption = "班级:"
Height = 255
Left = 1200
TabIndex = 20
Top = 4440
Width = 855
End
Begin VB.Label Label5
BackColor = &H00FFC0FF&
Caption = "(15-30岁之间)"
ForeColor = &H0000FF00&
Height = 375
Left = 3720
TabIndex = 18
Top = 2040
Width = 1215
End
Begin VB.Label Label4
BackColor = &H00FFC0FF&
Caption = "确认密码:"
Height = 255
Left = 1200
TabIndex = 17
Top = 3840
Width = 1095
End
Begin VB.Label Label2
BackColor = &H00FFC0FF&
Caption = "(密码长度不得超过10位)"
ForeColor = &H0000FF00&
Height = 375
Left = 3840
TabIndex = 15
Top = 3240
Width = 1335
End
Begin VB.Label Label1
BackColor = &H00FFC0FF&
Caption = "学号:"
Height = 255
Index = 0
Left = 1200
TabIndex = 13
Top = 360
Width = 855
End
Begin VB.Label Label3
BackColor = &H00FFC0FF&
Caption = "性别:"
Height = 255
Left = 1200
TabIndex = 12
Top = 1440
Width = 615
End
Begin VB.Label Label1
BackColor = &H00FFC0FF&
Caption = "姓名:"
Height = 255
Index = 1
Left = 1200
TabIndex = 11
Top = 960
Width = 615
End
Begin VB.Label Label1
BackColor = &H00FFC0FF&
Caption = "年龄:"
Height = 255
Index = 2
Left = 1200
TabIndex = 10
Top = 2040
Width = 975
End
Begin VB.Label Label1
BackColor = &H00FFC0FF&
Caption = "系别:"
Height = 255
Index = 3
Left = 1200
TabIndex = 9
Top = 2640
Width = 975
End
Begin VB.Label Label1
BackColor = &H00FFC0FF&
Caption = "密码:"
Height = 255
Index = 4
Left = 1200
TabIndex = 8
Top = 3240
Width = 975
End
End
Begin VB.Image Image4
Height = 480
Left = 600
Picture = "Frmsadd.frx":0016
Top = 240
Width = 480
End
Begin VB.Label Label10
BackColor = &H00FFC0FF&
Caption = "添加学生档案"
BeginProperty Font
Name = "楷体_GB2312"
Size = 26.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00C00000&
Height = 615
Left = 1320
TabIndex = 14
Top = 240
Width = 3495
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
If Trim(Text1(0).Text) = "" Then
MsgBox "学号不能为空!", vbExclamation + vbOKOnly, "警告"
Text1(0).SetFocus
Exit Sub
End If
Adodc1.ConnectionString = "Provider=MSDAORA.1;User ID=he;Persist Security Info=False"
sql = "select * from student where sno='" & Trim(Text1(0).Text) & "'"
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = sql
Adodc1.Refresh
If Adodc1.Recordset.EOF = False Then
MsgBox " 已经存在学号为" & Trim(Text1(0).Text) & "的学生!", vbExclamation + vbOKOnly, "警告"
Text1(0).SetFocus
Text1(0).SelStart = 0
Text1(0).SelLength = Len(Text1(0).Text)
Exit Sub
End If
If Trim(Text1(1).Text) = "" Then
MsgBox "姓名不能为空!", vbExclamation + vbOKOnly, "警告"
Text1(1).SetFocus
Exit Sub
End If
If Trim(Combo1(0).Text) = "" Then
MsgBox "请选择性别!", vbExclamation + vbOKOnly, "警告"
Combo1(0).SetFocus
Exit Sub
End If
If Trim(Combo2.Text) = "" Then
MsgBox "年龄不能为空!", vbExclamation + vbOKOnly, "警告"
Combo2.SetFocus
Exit Sub
End If
If Trim(Text1(3).Text) = "" Then
MsgBox "系别不能为空!", vbExclamation + vbOKOnly, "警告"
Text1(3).Text = ""
Text1(3).SetFocus
Exit Sub
End If
If Trim(Text1(4).Text) = "" Then
MsgBox "密码不能为空!", vbExclamation + vbOKOnly, "警告"
Text1(4).Text = ""
Text1(4).SetFocus
Exit Sub
End If
If Len(Text1(4).Text) > 10 Then
MsgBox "密码不能超过10位!", vbExclamation + vbOKOnly, "警告"
Text1(4).Text = ""
Text1(4).SetFocus
Exit Sub
End If
If Trim(Text1(4).Text) <> Trim(Text1(5).Text) Then
MsgBox "两次密码不一致!", vbExclamation + vbOKOnly, "警告"
Text1(5).Text = ""
Text1(5).SetFocus
Exit Sub
End If
If Trim(Text1(6).Text) = "" Then
MsgBox "班级不能为空!", vbExclamation + vbOKOnly, "警告"
Text1(6).Text = ""
Text1(6).SetFocus
Exit Sub
End If
Adodc1.Recordset.AddNew
Adodc1.Recordset.Fields("sno").Value = Trim(Text1(0).Text)
Adodc1.Recordset.Fields("name").Value = Trim(Text1(1).Text)
Adodc1.Recordset.Fields("sex").Value = Trim(Combo1(0).Text)
Adodc1.Recordset.Fields("age").Value = Val(Combo2)
Adodc1.Recordset.Fields("dept").Value = Trim(Text1(3).Text)
Adodc1.Recordset.Fields("key").Value = Trim(Text1(4).Text)
Adodc1.Recordset.Fields("class").Value = Trim(Text1(6).Text)
Adodc1.Recordset.Update
Adodc1.Refresh
MsgBox " 学生添加成功!", vbInformation + vbOKOnly, "警告"
Text1(0).Text = ""
Text1(1).Text = ""
Combo2.Text = ""
Text1(3).Text = ""
Text1(4).Text = ""
Text1(5).Text = ""
Text1(6).Text = ""
Combo1(0).Text = ""
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Combo2.AddItem "15"
Combo2.AddItem "16"
Combo2.AddItem "17"
Combo2.AddItem "18"
Combo2.AddItem "19"
Combo2.AddItem "20"
Combo2.AddItem "21"
Combo2.AddItem "22"
Combo2.AddItem "23"
Combo2.AddItem "24"
Combo2.AddItem "25"
Combo2.AddItem "26"
Combo2.AddItem "27"
Combo2.AddItem "28"
Combo2.AddItem "29"
Combo2.AddItem "30"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -