📄 prm.frm
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "Comdlg32.ocx"
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3900
ClientLeft = 60
ClientTop = 450
ClientWidth = 3480
LinkTopic = "Form1"
ScaleHeight = 3900
ScaleWidth = 3480
StartUpPosition = 3 '窗口缺省
Begin MSComDlg.CommonDialog CommonDialog1
Left = 240
Top = 3240
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin VB.CommandButton Command2
Caption = "录入"
Height = 375
Left = 1200
TabIndex = 9
Top = 3360
Width = 855
End
Begin VB.CommandButton Command1
Caption = "返回"
Height = 375
Left = 2280
TabIndex = 8
Top = 3360
Width = 855
End
Begin VB.Frame Frame1
Height = 3135
Left = 120
TabIndex = 0
Top = 120
Width = 3255
Begin VB.CommandButton Command5
Caption = "选择"
Height = 375
Left = 2160
TabIndex = 19
Top = 2160
Width = 735
End
Begin VB.CommandButton Command4
Caption = "选择"
Height = 375
Left = 2160
TabIndex = 18
Top = 1080
Width = 615
End
Begin VB.CommandButton Command3
Caption = "浏览.."
Height = 375
Left = 2400
TabIndex = 17
Top = 2640
Width = 735
End
Begin VB.TextBox Text7
Height = 375
Left = 1320
TabIndex = 16
Top = 2640
Width = 975
End
Begin VB.TextBox Text6
Height = 375
Left = 1320
TabIndex = 15
Top = 2160
Width = 735
End
Begin VB.TextBox Text5
Height = 375
Left = 1320
TabIndex = 14
Top = 1800
Width = 1335
End
Begin VB.TextBox Text4
Height = 375
Left = 1320
TabIndex = 13
Top = 1440
Width = 1335
End
Begin VB.TextBox Text3
Height = 375
Left = 1320
TabIndex = 12
Top = 1080
Width = 735
End
Begin VB.TextBox Text2
Height = 375
Left = 1320
TabIndex = 11
Top = 720
Width = 1335
End
Begin VB.TextBox Text1
Height = 375
Left = 1320
TabIndex = 10
Top = 360
Width = 1335
End
Begin VB.Label Label7
Caption = "照片"
Height = 255
Left = 120
TabIndex = 7
Top = 2640
Width = 975
End
Begin VB.Label Label6
Caption = "民族编号"
Height = 255
Left = 120
TabIndex = 6
Top = 2280
Width = 735
End
Begin VB.Label Label5
Caption = "出生日期"
Height = 255
Left = 120
TabIndex = 5
Top = 1920
Width = 855
End
Begin VB.Label Label4
Caption = "公民身份号码"
Height = 255
Left = 120
TabIndex = 4
Top = 1560
Width = 1095
End
Begin VB.Label Label3
Caption = "性别编号"
Height = 255
Left = 240
TabIndex = 3
Top = 1200
Width = 975
End
Begin VB.Label Label2
Caption = "姓名"
Height = 255
Left = 240
TabIndex = 2
Top = 840
Width = 855
End
Begin VB.Label Label1
Caption = "人员编号"
Height = 255
Left = 240
TabIndex = 1
Top = 480
Width = 735
End
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Private Sub Command1_Click()
Form1.Visible = False
End Sub
Private Sub Command2_Click()
If Len(Text1.Text) <> 5 Then
MsgBox "请输入5位的人员编号"
Text1.SetFocus
Exit Sub
End If
If Text2.Text = "" Then
MsgBox "姓名不能为空!"
Text2.SetFocus
Exit Sub
End If
If Text3.Text = "" Then
MsgBox "性别不能为空!"
Text3.SetFocus
Exit Sub
End If
If Not IsNumeric(Text4.Text) Then
MsgBox "请输入18位的数字身份证号码!"
Text4.SetFocus
Exit Sub
End If
If Not IsDate(Text5.Text) Then
MsgBox "请输入日期类型!"
Exit Sub
End If
cn.Open "Test", "sa"
rs.Open "select * from MemInf", cn, adOpenKeyset, adLockOptimistic
rs.AddNew
rs.Fields(0) = Trim(Text1.Text)
rs.Fields(1) = Trim(Text2.Text)
rs.Fields(2) = Trim(Text3.Text)
rs.Fields(3) = Trim(Text4.Text)
rs.Fields(4) = Trim(Text5.Text)
rs.Fields(5) = Trim(Text6.Text)
Dim stm As ADODB.Stream
Set stm = New ADODB.Stream
stm.Type = adTypeBinary
stm.Open
rs.Fields(6) = stm.Read
MsgBox "数据保存成功!!", 32, "人员信息"
Form1.Visible = False
rs.Update
Form2.DataGrid1.Columns(0) = rs.Fields(0)
Form2.DataGrid1.Columns(1) = rs.Fields(1)
Form2.DataGrid1.Columns(2) = rs.Fields(2)
Form2.DataGrid1.Columns(3) = rs.Fields(3)
Form2.DataGrid1.Columns(4) = rs.Fields(4)
Form2.DataGrid1.Columns(5) = rs.Fields(5)
rs.Close
End Sub
Private Sub Command3_Click()
CommonDialog1.DialogTitle = "F:\VB_Test\image"
CommonDialog1.Filter = "图片文件 (*.*)|*.*"
CommonDialog1.ShowOpen
Text7.Text = CommonDialog1.FileName
End Sub
Private Sub Command4_Click()
Form5.Show
End Sub
Private Sub Command5_Click()
Form6.Show
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If Not KeyAscii >= -20319 And KeyAscii <= -3652 Or KeyAscii = 8 Then
MsgBox "请输入中文姓名!"
Text2.SetFocus
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -