📄 frmupdate.frm
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomct2.ocx"
Begin VB.Form frmUpdate
BorderStyle = 3 'Fixed Dialog
Caption = "修改通讯信息"
ClientHeight = 4455
ClientLeft = 45
ClientTop = 435
ClientWidth = 7695
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Icon = "frmUpdate.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 4455
ScaleWidth = 7695
ShowInTaskbar = 0 'False
Begin VB.TextBox txtAddress
Height = 525
Left = 1320
MaxLength = 50
TabIndex = 10
Top = 3000
Width = 6135
End
Begin VB.TextBox txtZipCode
Height = 405
Left = 5280
MaxLength = 6
TabIndex = 6
Top = 960
Width = 2055
End
Begin VB.TextBox txtPhone
Height = 405
Left = 1320
MaxLength = 11
TabIndex = 5
Top = 2520
Width = 2175
End
Begin VB.TextBox txtMobile
Height = 405
Left = 5280
MaxLength = 11
TabIndex = 7
Top = 1440
Width = 2055
End
Begin VB.TextBox txtQQ
Height = 405
Left = 4920
MaxLength = 11
TabIndex = 8
Top = 1920
Width = 2415
End
Begin VB.TextBox txtEmail
Height = 405
Left = 4920
MaxLength = 30
TabIndex = 9
Top = 2400
Width = 2415
End
Begin VB.CommandButton cmdUpdate
Caption = "修改(&U)"
Height = 495
Left = 3360
TabIndex = 11
Top = 3720
Width = 1215
End
Begin VB.CommandButton cmdBack
Caption = "返回(&B)"
Height = 495
Left = 6120
TabIndex = 13
Top = 3720
Width = 1335
End
Begin VB.TextBox txtUser
Height = 405
Left = 1320
MaxLength = 30
TabIndex = 1
Top = 960
Width = 2175
End
Begin VB.CommandButton cmdReset
Caption = "重置(&R)"
Height = 495
Left = 4800
TabIndex = 12
Top = 3720
Width = 1215
End
Begin VB.TextBox txtID
BackColor = &H8000000E&
Height = 405
Left = 2400
MaxLength = 30
TabIndex = 0
Top = 240
Width = 3255
End
Begin VB.Frame Frame1
Height = 615
Left = 1320
TabIndex = 15
Top = 1320
Width = 2175
Begin VB.OptionButton optWoman
Caption = "女"
Height = 285
Left = 1200
TabIndex = 3
Top = 240
Width = 615
End
Begin VB.OptionButton optMan
Caption = "男"
Height = 285
Left = 120
TabIndex = 2
Top = 240
Width = 615
End
End
Begin VB.CommandButton cmdQuery
Caption = "查询(&Q)"
Height = 495
Left = 5760
TabIndex = 14
Top = 240
Width = 1335
End
Begin MSComCtl2.DTPicker dtpBirth
Height = 375
Left = 1320
TabIndex = 4
Top = 2040
Width = 2175
_ExtentX = 3836
_ExtentY = 661
_Version = 393216
Format = 25493505
CurrentDate = 39057
End
Begin VB.Label Label1
Caption = "姓名:"
Height = 375
Left = 120
TabIndex = 25
Top = 960
Width = 975
End
Begin VB.Label Label2
Caption = "性别:"
Height = 375
Left = 240
TabIndex = 24
Top = 1560
Width = 975
End
Begin VB.Label Label3
Caption = "出生日期:"
Height = 375
Left = 0
TabIndex = 23
Top = 2040
Width = 1455
End
Begin VB.Label Label4
Caption = "通信地址:"
Height = 375
Left = 0
TabIndex = 22
Top = 3120
Width = 1455
End
Begin VB.Label Label5
Caption = "邮政编码:"
Height = 375
Left = 3720
TabIndex = 21
Top = 960
Width = 1455
End
Begin VB.Label Label6
Caption = "电话号码:"
Height = 375
Left = 0
TabIndex = 20
Top = 2520
Width = 1455
End
Begin VB.Label Label8
Caption = "移动电话:"
Height = 375
Left = 3720
TabIndex = 19
Top = 1440
Width = 1455
End
Begin VB.Label Label9
Caption = "QQ:"
Height = 375
Left = 3720
TabIndex = 18
Top = 1920
Width = 1095
End
Begin VB.Label Label10
Caption = "E-Mail:"
Height = 375
Left = 3720
TabIndex = 17
Top = 2400
Width = 1215
End
Begin VB.Label Label7
AutoSize = -1 'True
Caption = "请输入用户编号:"
Height = 285
Left = 120
TabIndex = 16
Top = 240
Width = 2280
End
End
Attribute VB_Name = "frmUpdate"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdBack_Click()
Unload frmUpdate
End Sub
Private Sub cmdQuery_Click()
Dim strID$
strID = Trim(txtID.Text)
strID = Format(Val(strID))
If strID = "" Then
MsgBox "请输入用户编号!", 48, "修改"
Exit Sub
End If
strSQL = "select * from person where pid=" + strID
Set RS = conn.Execute(strSQL)
If RS.EOF Then
MsgBox "无此人信息!", 48, "修改"
RS.Close
Exit Sub
End If
txtUser.Text = RS.Fields(1).Value
If RS.Fields(2).Value = "男" Then
optMan.Value = 1
Else
optWoman.Value = 1
End If
dtpBirth.Value = RS.Fields(3).Value
txtAddress.Text = RS.Fields(4).Value
txtZipCode.Text = RS.Fields(5).Value
txtPhone.Text = RS.Fields(6).Value
txtMobile.Text = RS.Fields(7).Value
txtQQ.Text = RS.Fields(8).Value
txtEmail.Text = RS.Fields(9).Value
RS.Close
End Sub
Private Sub cmdReset_Click()
txtID.Text = ""
txtUser.Text = ""
optMan.Value = True
dtpBirth.Value = Date
txtAddress.Text = ""
txtZipCode.Text = ""
txtPhone.Text = ""
txtMobile.Text = ""
txtQQ.Text = ""
txtEmail.Text = ""
txtID.SetFocus
End Sub
Private Sub cmdUpdate_Click()
Dim strU$, strSex$, strBirth$, strAddress$
Dim strZip$, strPhone$, strMobile$
Dim strQQ$, strEmail$, strID$
strID = Trim(txtID.Text)
strID = Format(Val(txtID))
strU = Trim(txtUser.Text)
If optMan.Value = True Then
strSex = "男"
Else
strSex = "女"
End If
strBirth = Format(dtpBirth.Value, "yyyy-mm-dd")
strAddress = Trim(txtAddress.Text)
strZip = Trim(txtZipCode.Text)
strPhone = Trim(txtPhone.Text)
strMobile = Trim(txtMobile.Text)
strQQ = Trim(txtQQ.Text)
strEmail = Trim(txtEmail.Text)
If strID = "" Or strU = "" Or strSex = "" Or strBirth = "" Or strAddress = "" Or strZip = "" Or strPhone = "" Or strMobile = "" Or strQQ = "" Or strEmail = "" Then
MsgBox "信息未输入完全!", 48, "添加"
Exit Sub
End If
strSQL = "select * from person where pid=" + strID
Set RS = conn.Execute(strSQL)
If RS.EOF Then
MsgBox "无此人信息!", 48, "删除"
RS.Close
Exit Sub
End If
strSQL = "update person set pid="
strSQL = strSQL + strID + ",pname='" + strU + "',psex='" + strSex + "',pbirth='"
strSQL = strSQL + strBirth + "',paddress='" + strAddress + "',pzipcode='" + strZip + "',pphone='" + strPhone + "',pmobile='" + strMobile + "',pqq='" + strQQ + "',pemail='" + strEmail + "'"
strSQL = strSQL + " where pid=" + strID
conn.Execute strSQL
MsgBox "修改成功!", 48, "修改"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -