📄 teacher.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 8985
ClientLeft = 165
ClientTop = 855
ClientWidth = 11400
LinkTopic = "Form1"
ScaleHeight = 8985
ScaleWidth = 11400
StartUpPosition = 3 '窗口缺省
WindowState = 2 'Maximized
Begin VB.CommandButton Command7
Caption = "更改记录"
Height = 495
Left = 6240
TabIndex = 13
Top = 7440
Width = 1215
End
Begin VB.CommandButton Command6
Caption = "退出系统"
Height = 495
Left = 10200
TabIndex = 12
Top = 7440
Width = 1215
End
Begin VB.CommandButton Command5
Caption = "删除记录"
Height = 495
Left = 8280
TabIndex = 11
Top = 7440
Width = 1215
End
Begin VB.CommandButton Command4
Caption = "更新工资"
Height = 495
Left = 4200
TabIndex = 10
Top = 7440
Width = 1215
End
Begin VB.CommandButton Command3
Caption = "显示"
Height = 495
Left = 240
TabIndex = 9
Top = 7440
Width = 1215
End
Begin VB.TextBox Text6
Height = 495
Left = 9480
TabIndex = 7
Top = 9360
Width = 2055
End
Begin VB.TextBox Text5
Height = 495
Left = 6960
TabIndex = 6
Top = 9360
Width = 2295
End
Begin VB.TextBox Text4
Height = 495
Left = 4560
TabIndex = 5
Top = 9360
Width = 2055
End
Begin VB.TextBox Text3
Height = 495
Left = 2400
TabIndex = 4
Top = 9360
Width = 1935
End
Begin VB.TextBox Text2
Height = 495
Left = 240
TabIndex = 3
Top = 9360
Width = 1815
End
Begin VB.CommandButton Command2
Caption = "增添记录"
Height = 495
Left = 240
TabIndex = 2
Top = 8640
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "单个查询"
Height = 495
Left = 2280
TabIndex = 1
Top = 7440
Width = 1215
End
Begin VB.ListBox List1
Height = 6360
ItemData = "teacher.frx":0000
Left = 240
List = "teacher.frx":0002
TabIndex = 0
Top = 720
Width = 12255
End
Begin MSAdodcLib.Adodc Adodc1
Height = 735
Left = 12600
Top = 720
Visible = 0 'False
Width = 2775
_ExtentX = 4895
_ExtentY = 1296
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 = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=教师基本信息表;Data Source=LEON"
OLEDBString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=教师基本信息表;Data Source=LEON"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "SELECT * FROM 工资表"
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.Label Label1
Caption = "从下面得文本框内,分别输入序号,姓名,入校时间,赡养人数,原工资的值。点击增添记录按钮,进行增添记录操作"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 735
Left = 240
TabIndex = 8
Top = 8040
Width = 9375
End
Begin VB.Menu about
Caption = "关于"
Index = 1
Begin VB.Menu edition
Caption = "版本"
End
Begin VB.Menu exit
Caption = "退出"
End
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public Firstupdate As Integer
Public Firstadd As Integer
Private Sub Command1_Click()
Form2.Show
End Sub
'添加模块
Private Sub Command2_Click()
If Firstadd = 1 Then
Me.Text2.Text = "在此输入序号"
Me.Text3.Text = "在此输入姓名"
Me.Text4.Text = "在此输入入校时间"
Me.Text5.Text = "在此输入赡养人数"
Me.Text6.Text = "在此输入工资"
MsgBox "在根据方框内的提示正确输入"
Me.Text2.Text = ""
Me.Text3.Text = ""
Me.Text4.Text = ""
Me.Text5.Text = ""
Me.Text6.Text = ""
End If
Me.Text2.SetFocus
If Firstadd = 1 Then
Firstadd = Firstadd + 1
Exit Sub
End If
If Me.Text2.Text = "" Or Me.Text3.Text = "" Or Me.Text4 = "" Or Me.Text6.Text = "" Then
MsgBox "在方框内完整地输入要插入的信息"
Else
If Not IsNumeric(Me.Text2.Text) Or Not IsNumeric(Me.Text5.Text) Or Not IsNumeric(Me.Text6.Text) Then
MsgBox "插入值类型不匹配.增添记录失败"
GoTo error
End If
If Int(Me.Text5.Text) > 128 Then
MsgBox "赡养人数不能超过128"
GoTo error
End If
If Len(Me.Text3.Text) > 20 Then
MsgBox "姓名字长不超过20"
GoTo error
End If
If Len(Me.Text2.Text) > 9 Or Len(Me.Text6.Text) > 9 Then
MsgBox "序号或工资大小越界"
GoTo error
End If
If Not IsDate(Me.Text4.Text) Then
MsgBox "日期格式不能识别"
GoTo error
End If
'若游标打开 ,则关闭他,重新用查询语句打开游标
If ResOpen = 1 Then
RES.Close
ResOpen = 0
ResClose = 1
End If
'用查询语句打开游标
RES.ActiveConnection = Comsalary
RES.Source = "select * from 工资表"
RES.Open
ResOpen = 1
ResClose = 0
'判断是否有重复字段
For i = 0 To Me.List1.ListCount - 2
If Int(Me.Text2.Text) = RES.Fields("序号") Then
MsgBox "在关键字段插入了重复值,插入失败"
GoTo error
End If
RES.MoveNext
Next
'插入记录
If ResOpen = 1 Then
RES.Close
ResClose = 1
ResOpen = 0
RES.Source = "insert 工资表(序号,姓名,入校时间,赡养人数,原工资) values ( '" & Me.Text2.Text & "', '" & Me.Text3.Text & "','" & Me.Text4.Text & "','" & Me.Text5.Text & "', '" & Me.Text6.Text & "') "
RES.Open
ResOpen = 1
ResClose = 0
MsgBox "成功添加"
ResOpen = 0
ResClose = 1
Me.Adodc1.Refresh
Call showdata
End If
End If
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -