⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form2.frm

📁 用户 是xingshidong 密码123 一个功能齐全的 能运行的VB图书管理系统
💻 FRM
字号:
VERSION 5.00
Begin VB.Form tianjiaduzhexinxi 
   Caption         =   "添加读者信息"
   ClientHeight    =   5430
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   7995
   Icon            =   "Form2.frx":0000
   LinkTopic       =   "Form2"
   ScaleHeight     =   5430
   ScaleWidth      =   7995
   StartUpPosition =   3  '窗口缺省
   Begin VB.Frame Frame2 
      Height          =   1455
      Left            =   240
      TabIndex        =   8
      Top             =   3600
      Width           =   7575
      Begin VB.CommandButton Command3 
         Caption         =   "清空数据 "
         Height          =   495
         Left            =   5160
         TabIndex        =   11
         Top             =   480
         Width           =   1215
      End
      Begin VB.CommandButton Command2 
         Caption         =   "取消操作"
         Height          =   495
         Left            =   2880
         TabIndex        =   10
         Top             =   480
         Width           =   1215
      End
      Begin VB.CommandButton Command1 
         Caption         =   "确定"
         Height          =   495
         Left            =   720
         TabIndex        =   9
         Top             =   480
         Width           =   1215
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "读者信息"
      Height          =   2895
      Left            =   240
      TabIndex        =   0
      Top             =   480
      Width           =   7575
      Begin VB.ComboBox Combo1 
         Height          =   300
         Left            =   2400
         Style           =   2  'Dropdown List
         TabIndex        =   12
         Top             =   1560
         Width           =   1815
      End
      Begin VB.TextBox Text3 
         Height          =   375
         Left            =   2400
         TabIndex        =   7
         Top             =   2040
         Width           =   2535
      End
      Begin VB.TextBox Text2 
         Height          =   375
         Left            =   2400
         TabIndex        =   6
         Top             =   960
         Width           =   1815
      End
      Begin VB.TextBox Text1 
         Height          =   495
         Left            =   2400
         TabIndex        =   5
         Top             =   360
         Width           =   2535
      End
      Begin VB.Label Label4 
         Caption         =   "读者电话 "
         Height          =   375
         Left            =   960
         TabIndex        =   4
         Top             =   2040
         Width           =   735
      End
      Begin VB.Label Label3 
         Caption         =   "读者性别"
         Height          =   255
         Left            =   960
         TabIndex        =   3
         Top             =   1560
         Width           =   975
      End
      Begin VB.Label Label2 
         Caption         =   "读者姓名"
         Height          =   375
         Left            =   960
         TabIndex        =   2
         Top             =   960
         Width           =   975
      End
      Begin VB.Label Label1 
         Caption         =   "读者编号"
         Height          =   375
         Left            =   960
         TabIndex        =   1
         Top             =   480
         Width           =   1335
      End
   End
End
Attribute VB_Name = "tianjiaduzhexinxi"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim rs_addreader As New adodb.Recordset

Private Sub Command1_Click()
Dim sql As String
If Trim(Combo1.Text) = "" Then
   MsgBox "请选择读者性别 ", vbOKOnly + vbExclamation, ""
   Combo1.SetFocus
   Exit Sub
End If
If Trim(Text2.Text) = "" Then
   MsgBox "读者姓名不能为空", vbOKOnly + vbExclamation, ""
   Text2.SetFocus
   Exit Sub
End If
If Trim(Text1.Text) = "" Then
   MsgBox "读者编号不能为空", vbOKOnly + vbExclamation, ""
   Text1.SetFocus
   Exit Sub
End If
If Trim(Text3.Text) = "" Then
   MsgBox "读者电话不能为空", vbOKOnly + vbExclamation, ""
   Text3.SetFocus
   Exit Sub
End If
sql = "select * from readers where readerno='" & Text1.Text & "'"
rs_addreader.Open sql, conn, adOpenKeyset, adLockPessimistic
If rs_addreader.EOF Then
   rs_addreader.AddNew
   
   rs_addreader.Fields(0) = Trim(Text1.Text)
   rs_addreader.Fields(1) = Trim(Text2.Text)
   rs_addreader.Fields(2) = Trim(Combo1.Text)
   rs_addreader.Fields(3) = Trim(Text3.Text)
   rs_addreader.Update
   MsgBox "添加读者信息成功!", vbOKOnly, ""
   rs_addreader.Update
   rs_addreader.Close
   Unload Me
Else
   MsgBox "读者编号重复!", vbOKOnly + vbExclamation, ""
   Text2.SetFocus
   Text2.Text = ""
   rs_addreader.Close
   Exit Sub
End If
End Sub

Private Sub Command2_Click()
Unload Me
End Sub

Private Sub Command3_Click()
Text1.Text = Empty
Text2.Text = Empty
Text3.Text = Empty
End Sub
Private Sub Form_Load()
Combo1.AddItem "男"
Combo1.AddItem "女"
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -