📄 tianjiazhuanyexinxi.frm
字号:
VERSION 5.00
Begin VB.Form Tianjiazhuanyexinxi
Caption = "Form1"
ClientHeight = 6480
ClientLeft = 60
ClientTop = 450
ClientWidth = 8940
LinkTopic = "Form1"
ScaleHeight = 6480
ScaleWidth = 8940
StartUpPosition = 3 'Windows Default
Begin VB.TextBox Text
Height = 735
Index = 5
Left = 1320
TabIndex = 14
Top = 5280
Width = 1935
End
Begin VB.CommandButton cmdClose
Caption = "退出"
Height = 855
Left = 5400
TabIndex = 12
Top = 3600
Width = 1575
End
Begin VB.CommandButton cmdReset
Caption = "取消重填"
Height = 735
Left = 5400
TabIndex = 11
Top = 2400
Width = 1575
End
Begin VB.CommandButton cmdAdd
Caption = "添加"
Height = 855
Left = 5280
TabIndex = 10
Top = 1080
Width = 1695
End
Begin VB.TextBox Text
Height = 615
Index = 4
Left = 1320
TabIndex = 9
Top = 4440
Width = 1935
End
Begin VB.TextBox Text
Height = 735
Index = 3
Left = 1320
TabIndex = 8
Top = 3360
Width = 1935
End
Begin VB.TextBox Text
Height = 615
Index = 2
Left = 1320
TabIndex = 7
Top = 2400
Width = 1935
End
Begin VB.TextBox Text
Height = 615
Index = 1
Left = 1320
TabIndex = 6
Top = 1440
Width = 1935
End
Begin VB.TextBox Text
Height = 615
Index = 0
Left = 1320
TabIndex = 5
Top = 360
Width = 1935
End
Begin VB.Label Label6
Caption = "学院"
Height = 495
Left = 240
TabIndex = 13
Top = 5280
Width = 975
End
Begin VB.Label Label5
Caption = "负责人"
Height = 615
Left = 360
TabIndex = 4
Top = 4440
Width = 1335
End
Begin VB.Label Label4
Caption = "e-mail"
Height = 735
Left = 480
TabIndex = 3
Top = 3480
Width = 1215
End
Begin VB.Label Label3
Caption = "电话"
Height = 615
Left = 600
TabIndex = 2
Top = 2520
Width = 855
End
Begin VB.Label Label2
Caption = "名称"
Height = 615
Left = 600
TabIndex = 1
Top = 1680
Width = 1575
End
Begin VB.Label Label1
Caption = "编号"
Height = 495
Left = 720
TabIndex = 0
Top = 600
Width = 1335
End
End
Attribute VB_Name = "Tianjiazhuanyexinxi"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rs_user As New ADODB.Recordset
Dim rs_Xueyuan As New ADODB.Recordset
Private Sub cmdAdd_Click()
If Text(0).Text = "" Then
MsgBox "请输入编号!", vbOKOnly + vbInformation, "注意"
Text(0).SetFocus
Exit Sub
ElseIf Text(1).Text = "" Then
MsgBox "请输入名称!", vbOKOnly + vbInformation, "注意"
Text(1).SetFocus
Exit Sub
ElseIf Text(2).Text = "" Then
MsgBox "请输入电话!", vbOKOnly + vbInformation, "注意"
Text(2).SetFocus
Exit Sub
ElseIf Text(3).Text = "" Then
MsgBox "请输入e-mail!", vbOKOnly + vbInformation, "注意"
Text(3).SetFocus
Exit Sub
ElseIf Text(4).Text = "" Then
MsgBox "请输入负责人姓名!", vbOKOnly + vbInformation, "注意"
Text(4).SetFocus
Exit Sub
ElseIf Text(5).Text = "" Then
MsgBox "请输入学院名称!", vbOKOnly + vbInformation, "注意"
Text(4).SetFocus
Exit Sub
End If
Dim sqluser As String
'构造查询该用户名和密码的sql语句
sqluser = "select * from 专业信息表 where 编号 = '" & Text(0).Text _
& "'"
rs_user.CursorLocation = adUseClient
'打开数据游标
rs_user.Open sqluser, conn, adOpenKeyset, adLockPessimistic
If Not rs_user.EOF = True Then
MsgBox "该编号已经存在,请重新输入!", vbOKOnly + vbInformation, "注意"
rs_user.Close
Exit Sub
End If
rs_user.Close
rs_Xueyuan.AddNew
rs_Xueyuan.Fields(0) = Text(0).Text
rs_Xueyuan.Fields(1) = Text(1).Text
rs_Xueyuan.Fields(2) = Text(2).Text
rs_Xueyuan.Fields(3) = Text(3).Text
rs_Xueyuan.Fields(4) = Text(4).Text
rs_Xueyuan.Fields(5) = Text(5).Text
rs_Xueyuan.Update
MsgBox "添加学院信息成功!", vbOKOnly + vbExclamation, "注意"
For i = 0 To 5
Text(i).Text = ""
Next i
End Sub
Private Sub cmdClose_Click()
Unload Me
End Sub
Private Sub cmdReset_Click()
For i = 0 To 5
Text(i).Text = ""
Next i
End Sub
Private Sub Form_Load()
Dim X0 As Long
Dim Y0 As Long
'让窗体居中
X0 = Screen.Width
Y0 = Screen.Height
X0 = (X0 - Me.Width) / 2
Y0 = (Y0 - Me.Height) / 2
Me.Move X0, Y0
Dim sqladd As String
sqladd = "select * from 专业信息表 "
rs_Xueyuan.CursorLocation = adUseClient
rs_Xueyuan.Open sqladd, conn, adOpenKeyset, adLockPessimistic
End Sub
Private Sub Form_Unload(Cancel As Integer)
rs_Xueyuan.Close
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -