【VB开源代码栏目提醒】:网学会员在VB开源代码频道为大家收集整理了reader_insert.frm提供大家参考,希望对大家有所帮助!
VERSION 5.00
Begin VB.Form reader_insert
Caption = "注册新读者"
ClientHeight = 4995
ClientLeft = 60
ClientTop = 345
ClientWidth = 5835
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form1"
ScaleHeight = 4995
ScaleWidth = 5835
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Command2
Caption = "关闭"
Height = 495
Left = 3480
TabIndex = 12
Top = 3840
Width = 975
End
Begin VB.CommandButton Command1
Caption = "
注册"
Height = 495
Left = 1560
TabIndex = 11
Top = 3840
Width = 975
End
Begin VB.OptionButton Option2
Caption = "女"
Height = 375
Left = 3720
TabIndex = 9
Top = 1680
Width = 975
End
Begin VB.OptionButton Option1
Caption = "男"
Height = 375
Left = 2640
TabIndex = 8
Top = 1680
Value = -1 'True
Width = 975
End
Begin VB.TextBox Text4
Height = 375
Left = 2640
TabIndex = 6
Top = 2880
Width = 2055
End
Begin VB.TextBox Text3
Height = 375
Left = 2640
TabIndex = 4
Top = 2160
Width = 2055
End
Begin VB.TextBox Text2
Height = 375
Left = 2640
TabIndex = 2
Top = 1080
Width = 2055
End
Begin
VB.TextBox Text1
Height = 375
Left = 2640
TabIndex = 0
Top = 480
Width = 2055
End
Begin VB.Label Label5
Caption = "性别:"
Height = 375
Left = 960
TabIndex = 10
Top = 1680
Width = 1215
End
Begin VB.Label Label4
Caption = "班级:"
Height = 375
Left = 960
TabIndex = 7
Top = 2880
Width = 1215
End
Begin VB.Label Label3
Caption = "年龄:"
Height = 375
Left = 960
TabIndex = 5
Top = 2280
Width = 1215
End
Begin VB.Label Label2
Caption = ":"
Height = 375
Left = 960
TabIndex = 3
Top = 1080
Width = 1215
End
Begin VB.Label Label1
Caption = "借书证号:"
Height = 375
Left = 960
TabIndex = 1
Top = 480
Width = 1215
End
End
Attribute VB_Name = "reader_insert"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\file.mdb;Persist Security Info=False"
sql = "select * from info_reader where rno='" & Text1.Text & "'"
rs.Open sql, cn, 1, 1
If rs.EOF <> True Then
MsgBox "该借书证号已经存在!请确认"
Text1.Text = ""
Text1.SetFocus
Else
rs.Close
If (Text2.Text <> "" And Text3.Text <> "" And Text4 <> "") Then
sql = "select * from info_reader"
rs.Open sql, cn, 3, 2
rs.AddNew
rs("rno") = Trim(Text1.Text)
rs("rname") = Trim(Text2.Text)
If Option1.Value = True Then
rs("rgentle") = "男"
Else
rs("rgentle") = "女"
End If
rs("rage") = Trim(Text3.Text)
rs("rclass") = Trim(Text4.Text)
rs.Update
MsgBox "注册成功"
Else
MsgBox "请填写完整所有信息"
End If
End If
End Sub