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

📄 frmaddreaderinfo.frm

📁 中北大学数据库课程设计
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmaddreaderinfo 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "添加读者信息"
   ClientHeight    =   4170
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   6810
   Icon            =   "frmaddreaderinfo.frx":0000
   LinkTopic       =   "Form2"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   4170
   ScaleWidth      =   6810
   Begin VB.Frame Frame2 
      Height          =   690
      Left            =   1800
      TabIndex        =   17
      Top             =   3300
      Width           =   2970
      Begin VB.CommandButton Command2 
         Caption         =   "取消"
         Height          =   360
         Left            =   1875
         TabIndex        =   19
         Top             =   225
         Width           =   660
      End
      Begin VB.CommandButton Command1 
         Caption         =   "确定"
         Height          =   360
         Left            =   450
         TabIndex        =   18
         Top             =   225
         Width           =   660
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "读者信息"
      Height          =   3210
      Left            =   75
      TabIndex        =   0
      Top             =   75
      Width           =   6660
      Begin VB.TextBox Text6 
         Height          =   375
         Left            =   4800
         TabIndex        =   16
         Top             =   240
         Width           =   1530
      End
      Begin VB.TextBox Text5 
         Height          =   375
         Left            =   4800
         TabIndex        =   14
         Top             =   1350
         Width           =   1530
      End
      Begin VB.TextBox Text4 
         Height          =   375
         Left            =   1275
         TabIndex        =   12
         Top             =   2550
         Width           =   5055
      End
      Begin VB.TextBox Text3 
         Height          =   375
         Left            =   1275
         TabIndex        =   10
         Top             =   1950
         Width           =   5055
      End
      Begin VB.ComboBox Combo2 
         Height          =   300
         Left            =   4800
         Style           =   2  'Dropdown List
         TabIndex        =   8
         Top             =   825
         Width           =   1560
      End
      Begin VB.TextBox Text2 
         Height          =   375
         Left            =   1275
         TabIndex        =   6
         Top             =   1350
         Width           =   1455
      End
      Begin VB.TextBox Text1 
         Height          =   375
         Left            =   1275
         TabIndex        =   4
         Top             =   750
         Width           =   1470
      End
      Begin VB.ComboBox Combo1 
         Height          =   300
         Left            =   1275
         Style           =   2  'Dropdown List
         TabIndex        =   2
         Top             =   300
         Width           =   1455
      End
      Begin VB.Label Label8 
         AutoSize        =   -1  'True
         Caption         =   "登记日期"
         Height          =   180
         Left            =   3750
         TabIndex        =   15
         Top             =   360
         Width           =   720
      End
      Begin VB.Label Label7 
         AutoSize        =   -1  'True
         Caption         =   "电话号码"
         Height          =   180
         Left            =   3675
         TabIndex        =   13
         Top             =   1425
         Width           =   720
      End
      Begin VB.Label Label6 
         AutoSize        =   -1  'True
         Caption         =   "家庭住址"
         Height          =   180
         Left            =   375
         TabIndex        =   11
         Top             =   2625
         Width           =   720
      End
      Begin VB.Label Label5 
         AutoSize        =   -1  'True
         Caption         =   "工作单位"
         Height          =   180
         Left            =   375
         TabIndex        =   9
         Top             =   2025
         Width           =   720
      End
      Begin VB.Label Label4 
         AutoSize        =   -1  'True
         Caption         =   "性别"
         Height          =   180
         Left            =   4050
         TabIndex        =   7
         Top             =   825
         Width           =   360
      End
      Begin VB.Label Label3 
         AutoSize        =   -1  'True
         Caption         =   "读者编号"
         Height          =   180
         Left            =   375
         TabIndex        =   5
         Top             =   1425
         Width           =   720
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         Caption         =   "读者姓名"
         Height          =   180
         Left            =   375
         TabIndex        =   3
         Top             =   900
         Width           =   720
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "读者类别"
         Height          =   180
         Left            =   375
         TabIndex        =   1
         Top             =   375
         Width           =   720
      End
   End
End
Attribute VB_Name = "frmaddreaderinfo"
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(Text1.Text) = "" Then
   MsgBox "读者姓名不能为空", vbOKOnly + vbExclamation, ""
   Text1.SetFocus
   Exit Sub
End If
If Trim(Text2.Text) = "" Then
   MsgBox "读者编号不能为空", vbOKOnly + vbExclamation, ""
   Text2.SetFocus
   Exit Sub
End If
sql = "select * from 读者信息 where 读者编号='" & Text2.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(Combo2.Text)
   rs_addreader.Fields(3) = Trim(Combo1.Text)
   rs_addreader.Fields(4) = Trim(Text3.Text)
   rs_addreader.Fields(5) = Trim(Text4.Text)
   rs_addreader.Fields(6) = Trim(Text5.Text)
   rs_addreader.Fields(7) = CDate(Text6.Text)
   rs_addreader.Update
   MsgBox "添加读者信息成功!", vbOKOnly, ""
   rs_addreader.Close
Else
   MsgBox "读者编号重复!", vbOKOnly + vbExclamation, ""
   Text1.SetFocus
   Text1.Text = ""
   rs_addreader.Close
   Exit Sub
End If

End Sub

Private Sub Command2_Click()
Unload Me
End Sub

Private Sub Form_Load()
Combo2.AddItem "男"
Combo2.AddItem "女"
Dim rs_leibie As New ADODB.Recordset
Dim sql As String
sql = "select * from 读者类别"
rs_leibie.Open sql, conn, adOpenKeyset, adLockPessimistic
rs_leibie.MoveFirst
Do While Not rs_leibie.EOF
  Combo1.AddItem rs_leibie.Fields(0)
  rs_leibie.MoveNext
Loop
rs_leibie.Close
End Sub

⌨️ 快捷键说明

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