📄 adddepart.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form adddepart
BorderStyle = 1 'Fixed Single
Caption = "部门管理"
ClientHeight = 3000
ClientLeft = 45
ClientTop = 435
ClientWidth = 4905
LinkTopic = "Form2"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 3000
ScaleWidth = 4905
Begin VB.CommandButton Command2
Caption = "返回"
Height = 375
Left = 2520
TabIndex = 7
Top = 2520
Width = 855
End
Begin VB.CommandButton Command1
Caption = "添加"
Height = 375
Left = 960
TabIndex = 6
Top = 2520
Width = 855
End
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 1800
Top = 3120
Visible = 0 'False
Width = 1575
_ExtentX = 2778
_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 = "Provider=MSDASQL.1;Persist Security Info=False;Data Source=qygzgl"
OLEDBString = "Provider=MSDASQL.1;Persist Security Info=False;Data Source=qygzgl"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.Frame Frame1
Height = 1695
Left = 600
TabIndex = 0
Top = 600
Width = 3735
Begin VB.TextBox Text2
BackColor = &H00C0E0FF&
Height = 285
Left = 1800
TabIndex = 4
Top = 1080
Width = 1335
End
Begin VB.TextBox Text1
BackColor = &H00C0E0FF&
Height = 285
Left = 1800
TabIndex = 3
Top = 360
Width = 1335
End
Begin VB.Label Label2
Caption = "部门名称:"
Height = 375
Left = 360
TabIndex = 2
Top = 1080
Width = 1095
End
Begin VB.Label Label1
Caption = "部门ID号:"
Height = 255
Left = 360
TabIndex = 1
Top = 360
Width = 1335
End
End
Begin VB.Label Label3
Caption = "企业部门的编辑"
BeginProperty Font
Name = "MS Sans Serif"
Size = 13.5
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H008080FF&
Height = 375
Left = 1080
TabIndex = 5
Top = 120
Width = 2415
End
End
Attribute VB_Name = "adddepart"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Command1_Click()
Dim conn As New ADODB.Connection
conn.ConnectionString = "Provider=MSDASQL.1;Persist Security Info=False;Data Source=qygzgl"
conn.Open
If Trim(Text1.Text) <> Empty And Trim(Text2.Text) <> Empty Then
On Error GoTo ErrAddUser
conn.Execute "insert into 部门管理(部门编号,部门名称)values('" & Text1.Text & "','" & Text2.Text & "')" '更新记录
MsgBox "部门添加成功", , "添加成功"
Text1 = ""
Text2 = ""
Text1.SetFocus
Else
MsgBox "请输入要添加的部门编号和名称 ", vbInformation + vbOKOnly, "错误提示"
End If
Exit Sub
ErrAddUser:
MsgBox "用户已存在 ", vbInformation + vbOKOnly, "提示信息"
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -