📄 form12.frm
字号:
VERSION 5.00
Begin VB.Form Form12
BackColor = &H00FFFFFF&
Caption = "开户"
ClientHeight = 8595
ClientLeft = 165
ClientTop = 450
ClientWidth = 10665
BeginProperty Font
Name = "楷体_GB2312"
Size = 15
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form12"
Picture = "Form12.frx":0000
ScaleHeight = 8595
ScaleWidth = 10665
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command2
BackColor = &H00C0E0FF&
Caption = "退出"
Height = 615
Left = 6000
Style = 1 'Graphical
TabIndex = 2
Top = 7920
Width = 2055
End
Begin VB.CommandButton Command1
BackColor = &H00C0E0FF&
Caption = "确定"
Height = 615
Left = 2400
Style = 1 'Graphical
TabIndex = 1
Top = 7920
Width = 2055
End
Begin VB.Frame Frame1
BackColor = &H00FFC0C0&
Caption = "开户"
Height = 7455
Left = 600
TabIndex = 0
Top = 240
Width = 9495
Begin VB.ComboBox Combo1
Height = 420
ItemData = "Form12.frx":192F0
Left = 2520
List = "Form12.frx":192FD
Style = 2 'Dropdown List
TabIndex = 20
Top = 4320
Width = 3135
End
Begin VB.TextBox Text8
Alignment = 2 'Center
Height = 495
Left = 2520
TabIndex = 19
Top = 6000
Width = 2175
End
Begin VB.TextBox Text7
Alignment = 2 'Center
Height = 495
Left = 2520
TabIndex = 17
Top = 5160
Width = 2175
End
Begin VB.TextBox Text6
Alignment = 2 'Center
Height = 495
Left = 2520
TabIndex = 14
Top = 6720
Width = 3255
End
Begin VB.TextBox Text5
Alignment = 2 'Center
Height = 495
Left = 2520
TabIndex = 12
Top = 3480
Width = 2175
End
Begin VB.TextBox Text4
Alignment = 2 'Center
Height = 495
Left = 2520
TabIndex = 11
Top = 2640
Width = 3255
End
Begin VB.TextBox Text3
Alignment = 2 'Center
Height = 495
IMEMode = 3 'DISABLE
Left = 2520
PasswordChar = "*"
TabIndex = 10
Top = 1920
Width = 2175
End
Begin VB.TextBox Text2
Alignment = 2 'Center
Height = 495
IMEMode = 3 'DISABLE
Left = 2520
PasswordChar = "*"
TabIndex = 9
Top = 1200
Width = 2175
End
Begin VB.TextBox Text1
Alignment = 2 'Center
Height = 495
Left = 2520
TabIndex = 4
Top = 480
Width = 2175
End
Begin VB.Label Label9
Alignment = 2 'Center
BackColor = &H00C0E0FF&
Caption = "电话"
Height = 495
Left = 360
TabIndex = 18
Top = 6000
Width = 1575
End
Begin VB.Label Label8
Alignment = 2 'Center
BackColor = &H00C0E0FF&
Caption = "住址"
Height = 495
Left = 360
TabIndex = 16
Top = 5160
Width = 1575
End
Begin VB.Label Label7
Alignment = 2 'Center
BackColor = &H00C0E0FF&
Caption = "开户金额"
Height = 495
Left = 360
TabIndex = 15
Top = 3480
Width = 1575
End
Begin VB.Label Label6
Alignment = 2 'Center
BackColor = &H00C0E0FF&
Caption = "帐户类型"
Height = 495
Left = 360
TabIndex = 13
Top = 4320
Width = 1575
End
Begin VB.Label Label5
Alignment = 2 'Center
BackColor = &H00C0E0FF&
Caption = "您的卡号"
Height = 495
Left = 360
TabIndex = 8
Top = 6720
Width = 1575
End
Begin VB.Label Label4
Alignment = 2 'Center
BackColor = &H00C0E0FF&
Caption = "身份证号"
Height = 495
Left = 360
TabIndex = 7
Top = 2640
Width = 1575
End
Begin VB.Label Label3
Alignment = 2 'Center
BackColor = &H00C0E0FF&
Caption = "密码确认"
Height = 495
Left = 360
TabIndex = 6
Top = 1920
Width = 1575
End
Begin VB.Label Label2
Alignment = 2 'Center
BackColor = &H00C0E0FF&
Caption = "密码"
Height = 495
Left = 360
TabIndex = 5
Top = 1200
Width = 1575
End
Begin VB.Label Label1
Alignment = 2 'Center
BackColor = &H00C0E0FF&
Caption = "用户名"
Height = 495
Left = 360
TabIndex = 3
Top = 480
Width = 1575
End
End
End
Attribute VB_Name = "Form12"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim con As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim rst As New ADODB.Recordset
Dim rstl As New ADODB.Recordset
Private Sub Command1_Click()
con.Open "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=wuhao"
If Text1.Text = "" Then
MsgBox "用户名不能为空!"
Text1.SetFocus
ElseIf Text4.Text = "" Then
MsgBox "身份证号不能为空!"
Text4.SetFocus
ElseIf Text5.Text = "" Then
MsgBox "开户金额不能为空!"
Text5.SetFocus
ElseIf Text5.Text < 10 Then
MsgBox "开户金额不能低于10元!"
Text5.SetFocus
ElseIf Text2.Text = "" Then
MsgBox "密码不能为空!"
Text2.SetFocus
ElseIf Len(Text1.Text) > 15 Then
MsgBox "姓名不能长于15位英文或7位中文"
Text1.SetFocus
ElseIf Len(Text4.Text) > 20 Then
MsgBox "身份证号码不得长于20位"
Text4.SetFocus
ElseIf Len(Text6.Text) > 50 Then
MsgBox "金额不得大于50位"
Text6.SetFocus
ElseIf Len(Text7.Text) > 20 Then
MsgBox "密码不得大于20位"
Text7.SetFocus
ElseIf Text2.Text <> Text3.Text Then
MsgBox "两次输入的密码不一致,请重新输入"
Text2.SetFocus
Else
rst.Open "select customer_id from customer_xx053_19", con, adOpenKeyset, adLockOptimistic
If (rst.EOF) Then
Text6.Text = "0903050301"
Else
hello = rst.Sort
rst.MoveLast
Text6.Text = Left("0903050300" & CStr(CLng(rst.Fields(0)) + 1), 10)
End If
rst.Close
rstl.Open "select * from customer_xx053_19 ", con, adOpenKeyset, adLockOptimistic
rstl.AddNew
rstl.Fields(0) = Trim(Text1.Text)
rstl.Fields(1) = Trim(Text4.Text)
rstl.Fields(2) = Trim(Text7.Text)
rstl.Fields(3) = Trim(Text8.Text)
rstl.Update
rstl.Close
rs.Open "select * from account_xx053_19", con, adOpenKeyset, adLockOptimistic
rs.AddNew
rs.Fields(0) = Trim(Text6.Text)
rs.Fields(1) = Trim(Text4.Text)
rs.Fields(2) = Trim(Combo1.Text)
rs.Fields(3) = Trim(Text5.Text)
rs.Fields(4) = Trim(Text2.Text)
rs.Update
MsgBox "成功添加数据"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
rs.Close
con.Close
End If
End Sub
Private Sub Command2_Click()
Unload Me
Form4.Show
End Sub
Private Sub Frame1_DragDrop(Source As Control, X As Single, Y As Single)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -