📄 form_userinsert.frm
字号:
VERSION 5.00
Begin VB.Form Form_UserInsert
Caption = "添加用户"
ClientHeight = 2865
ClientLeft = 3990
ClientTop = 2535
ClientWidth = 4590
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 2865
ScaleWidth = 4590
Begin VB.CommandButton Command2
Caption = "取消"
Height = 375
Left = 3480
TabIndex = 7
Top = 2280
Width = 975
End
Begin VB.CommandButton Command_UserInsert_OK
Caption = "确定"
Height = 375
Left = 1920
TabIndex = 6
Top = 2280
Width = 975
End
Begin VB.ComboBox Combo_UserInsertType
Height = 300
ItemData = "Form_UserInsert.frx":0000
Left = 1680
List = "Form_UserInsert.frx":000A
Style = 2 'Dropdown List
TabIndex = 4
Top = 1680
Width = 1575
End
Begin VB.TextBox Text_UserInsert_Pwd
Height = 495
Left = 1680
TabIndex = 2
Top = 960
Width = 1575
End
Begin VB.TextBox Text_UserInsert_Name
Height = 495
Left = 1680
TabIndex = 0
Top = 240
Width = 1575
End
Begin VB.Label Label5
Caption = "限制50个字符内"
Height = 375
Left = 3480
TabIndex = 9
Top = 960
Width = 975
End
Begin VB.Label Label4
Caption = "限制50个字符内"
Height = 375
Left = 3480
TabIndex = 8
Top = 240
Width = 975
End
Begin VB.Label Label3
Caption = "权限: "
Height = 375
Left = 240
TabIndex = 5
Top = 1680
Width = 975
End
Begin VB.Label Label2
Caption = "密码: "
Height = 375
Left = 240
TabIndex = 3
Top = 1080
Width = 975
End
Begin VB.Label Label1
Caption = "用户姓名: "
Height = 495
Left = 240
TabIndex = 1
Top = 360
Width = 1095
End
End
Attribute VB_Name = "Form_UserInsert"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command_UserInsert_OK_Click()
Dim sqlstr As String
Dim rscheck As New ADODB.Recordset
'打开家庭成员表
rscheck.Open "select * from Family where FamilyName='" & Trim(Me.Text_UserInsert_Name.Text) & _
"'", RemoteCnn, adOpenStatic, adLockReadOnly, -1
If rscheck.RecordCount > 0 Then
MsgBox "用户已存在,请重新输入!"
Exit Sub
End If
rscheck.Close
If Me.Text_UserInsert_Name.Text = "" Or Me.Text_UserInsert_Pwd.Text = "" _
Or Me.Combo_UserInsertType.Text = "" Then
MsgBox "不能为空白!"
Exit Sub
ElseIf Len(Trim(Me.Text_UserInsert_Name.Text)) > 50 _
Or Len(Trim(Me.Text_UserInsert_Pwd.Text)) > 50 Then
MsgBox "您输入的姓名或密码过长!" & vbCrLf & "请重新输入!"
Exit Sub
End If
On Error Resume Next
'添加一个用户到数据库
sqlstr = "insert into Family" & "(FamilyName,FamilyPwd,FamilyType)" & _
"values(" & "'" & Me.Text_UserInsert_Name.Text & "'," & _
"'" & Me.Text_UserInsert_Pwd.Text & "'," & _
Val(Me.Combo_UserInsertType.Text) & ");"
RemoteCnn.Execute sqlstr
MsgBox "添加成功!"
'Unload Me
'Me.Text_UserInsert_Name.Text = ""
'Me.Text_UserInsert_Pwd.Text = ""
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -