📄 luru.frm
字号:
VERSION 5.00
Begin VB.Form luru
Caption = "录入"
ClientHeight = 6615
ClientLeft = 60
ClientTop = 450
ClientWidth = 7035
LinkTopic = "Form2"
ScaleHeight = 6615
ScaleWidth = 7035
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox Text3
Height = 375
Left = 1680
TabIndex = 24
Top = 960
Visible = 0 'False
Width = 975
End
Begin VB.CheckBox Check3
Caption = "男"
Height = 375
Left = 1680
TabIndex = 14
Top = 3360
Width = 975
End
Begin VB.CheckBox Check4
Caption = "女"
Height = 375
Left = 2640
TabIndex = 13
Top = 3360
Width = 855
End
Begin VB.TextBox Text6
Height = 495
Left = 1680
TabIndex = 12
Top = 2520
Width = 1575
End
Begin VB.TextBox Text5
Height = 495
Left = 1680
TabIndex = 10
Top = 1680
Width = 1575
End
Begin VB.OptionButton Option2
Caption = "操作员"
Height = 495
Left = 3240
TabIndex = 7
Top = 240
Width = 1095
End
Begin VB.OptionButton Option1
Caption = "管理员"
Height = 495
Left = 1920
TabIndex = 6
Top = 240
Width = 975
End
Begin VB.CommandButton Command2
Caption = "取消"
Height = 615
Left = 3720
TabIndex = 5
Top = 5640
Width = 1455
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 615
Left = 1440
TabIndex = 4
Top = 5640
Width = 1455
End
Begin VB.TextBox Text2
Height = 375
Left = 1560
TabIndex = 2
Top = 4440
Width = 2175
End
Begin VB.TextBox Text1
Height = 375
Left = 1560
TabIndex = 1
Top = 3960
Width = 2175
End
Begin VB.Label Label14
Caption = "编号"
Height = 375
Left = 120
TabIndex = 23
Top = 960
Visible = 0 'False
Width = 1215
End
Begin VB.Label Label13
Caption = "(*)"
Height = 375
Left = 4560
TabIndex = 22
Top = 360
Width = 615
End
Begin VB.Label Label12
Caption = "(*)"
Height = 255
Left = 4680
TabIndex = 21
Top = 4200
Width = 495
End
Begin VB.Label Label11
Caption = "(*)"
Height = 255
Left = 4680
TabIndex = 20
Top = 4560
Width = 495
End
Begin VB.Label Label10
Caption = "(*)"
Height = 255
Left = 4680
TabIndex = 19
Top = 3600
Width = 495
End
Begin VB.Label Label6
Caption = "(*)"
Height = 255
Left = 4680
TabIndex = 18
Top = 2760
Width = 495
End
Begin VB.Label Label5
Caption = "(*)"
Height = 255
Left = 4680
TabIndex = 17
Top = 1800
Width = 495
End
Begin VB.Label Label4
Caption = "带(*)的为必填选项"
Height = 255
Left = 5280
TabIndex = 16
Top = 2040
Width = 1815
End
Begin VB.Label Label9
Caption = "性别:"
Height = 375
Left = 120
TabIndex = 15
Top = 3360
Width = 1335
End
Begin VB.Label Label8
Caption = "年龄:"
Height = 375
Left = 120
TabIndex = 11
Top = 2520
Width = 735
End
Begin VB.Label Label7
Caption = "姓名 :"
Height = 375
Left = 120
TabIndex = 9
Top = 1680
Width = 1335
End
Begin VB.Label Label3
Caption = "选择录入人权限:"
Height = 375
Left = 120
TabIndex = 8
Top = 360
Width = 1455
End
Begin VB.Label Label2
Caption = "密码:"
Height = 255
Left = 240
TabIndex = 3
Top = 4560
Width = 855
End
Begin VB.Label Label1
Caption = "账号:"
Height = 255
Left = 240
TabIndex = 0
Top = 4080
Width = 855
End
End
Attribute VB_Name = "luru"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
If Text1.Text = "" Or Text2.Text = "" Or (Option1.Value = False And Option2.Value = False) Or Text5.Text = "" Or Text6.Text = "" Or (Check3.Value = 0 And Check4.Value = 0) Then
MsgBox "请填写完全!"
Exit Sub
Else
If Option1.Value = True Then
Call connectDB1
adoRS1.Open "admin_05_10", adoCon1
If Not adoRS1 Then
adoRS1.AddNew
adoRS1("name") = Text1.Text
adoRS1("password") = Text2.Text
adoRS1("姓名") = Text5.Text
adoRS1("年龄") = Text6.Text
If Check3.Value = 1 Then
adoRS1("性别") = "男"
ElseIf Check4.Value = 1 Then
adoRS1("性别") = "女"
End If
adoRS1.Update
adoRS1.MoveNext
kaihu.Show
Text1.Text = ""
Text2.Text = ""
Option1.Value = False
Text6.Text = ""
Check3.Value = 0
Check4.Value = 0
End If
Else
Call connectDB1
adoRS1.Open "id_05_10", adoCon1
If Not adoRS1 Then
adoRS1.AddNew
adoRS1("编号") = Text3.Text
adoRS1("name") = Text1.Text
adoRS1("password") = Text2.Text
adoRS1("姓名") = Text5.Text
adoRS1("年龄") = Text6.Text
If Check3.Value = 1 Then
adoRS1("性别") = "男"
ElseIf Check4.Value = 1 Then
adoRS1("性别") = "女"
End If
adoRS1.Update
adoRS1.MoveNext
kaihu.Show
Text1.Text = ""
Text2.Text = ""
Option2.Value = False
Text6.Text = ""
Check3.Value = 0
Check4.Value = 0
End If
End If
End If
End Sub
Private Sub Command2_Click()
guanli.Show
Unload Me
End Sub
Private Sub Check3_Click()
Check4.Value = 0
End Sub
Private Sub Check4_Click()
Check3.Value = 0
End Sub
Private Sub Option1_Click()
Label14.Visible = False
Text3.Visible = False
Dim cn1 As ADODB.Connection
Set cn1 = New ADODB.Connection
cn1.Open "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=bank;Data Source=B14"
Dim rss1 As ADODB.Recordset
Set rss1 = New ADODB.Recordset
strsql1 = "select * from admin_05_10 where name ='" & Trim(Text1.Text) & "'"
rss1.Open strsql1, cn1, adOpenKeyset, adLockOptimistic
Do While Not rss1.EOF
MsgBox "此卡号已存在请更换!"
Text1.Text = ""
Text2.Text = ""
Option1.Value = False
Text1.SetFocus
rss1.MoveNext
Loop
End Sub
Private Sub Option2_Click()
Dim cn1 As ADODB.Connection
Set cn1 = New ADODB.Connection
cn1.Open "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=bank;Data Source=B14"
Dim rss1 As ADODB.Recordset
Set rss1 = New ADODB.Recordset
strsql1 = "select * from id_05_10 where name ='" & Trim(Text1.Text) & "'"
rss1.Open strsql1, cn1, adOpenKeyset, adLockOptimistic
Do While Not rss1.EOF
MsgBox "此卡号已存在请更换!"
Text1.Text = ""
Text2.Text = ""
Option2.Value = False
Text1.SetFocus
rss1.MoveNext
Loop
Label14.Visible = True
Text3.Visible = True
End Sub
Private Sub Text5_Change()
Dim cn2 As ADODB.Connection
Set cn2 = New ADODB.Connection
cn2.Open "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=bank;Data Source=B14"
Dim rss2 As ADODB.Recordset
Set rss2 = New ADODB.Recordset
strsql2 = "select * from id_05_10 where 编号='" & Trim(Text3.Text) & "'"
rss2.Open strsql2, cn2, adOpenKeyset, adLockOptimistic
Do While Not rss2.EOF
MsgBox "此编号已存在请更换!"
Text5.Text = ""
Text3.Text = ""
Text3.SetFocus
rss2.MoveNext
Loop
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -