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

📄 frmsearch.frm

📁 自己的作品。。基于VB的图书馆管理系统。 感觉很有现实意义
💻 FRM
📖 第 1 页 / 共 3 页
字号:
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column06 
            DataField       =   "Email"
            Caption         =   "电子邮箱"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column07 
            DataField       =   "Deposite"
            Caption         =   "按金"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column08 
            DataField       =   "Dojoin"
            Caption         =   "加入时间"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column09 
            DataField       =   "Doexpire"
            Caption         =   "期满时间"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column10 
            DataField       =   "Noted"
            Caption         =   "备注"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         SplitCount      =   1
         BeginProperty Split0 
            BeginProperty Column00 
               ColumnWidth     =   824.882
            EndProperty
            BeginProperty Column01 
               ColumnWidth     =   1604.976
            EndProperty
            BeginProperty Column02 
               ColumnWidth     =   3404.977
            EndProperty
            BeginProperty Column03 
               ColumnWidth     =   1665.071
            EndProperty
            BeginProperty Column04 
               ColumnWidth     =   2505.26
            EndProperty
            BeginProperty Column05 
               ColumnWidth     =   1170.142
            EndProperty
            BeginProperty Column06 
               ColumnWidth     =   1230.236
            EndProperty
            BeginProperty Column07 
               ColumnWidth     =   1184.882
            EndProperty
            BeginProperty Column08 
               ColumnWidth     =   1140.095
            EndProperty
            BeginProperty Column09 
               ColumnWidth     =   734.74
            EndProperty
            BeginProperty Column10 
               ColumnWidth     =   2429.858
            EndProperty
         EndProperty
      End
   End
   Begin VB.Label lbl_status 
      BackStyle       =   0  'Transparent
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   720
      TabIndex        =   17
      Top             =   120
      Width           =   8895
   End
End
Attribute VB_Name = "frmSearch"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim fnd As String
Dim mflag As Boolean
Dim bflag As Boolean
Dim conn As ADODB.Connection
Dim MR As ADODB.Recordset
Dim BR As ADODB.Recordset

Private Sub cmb_bfield_click()
If (cmb_bfield.Text = "所有") Then
txt_bvalue.Enabled = False
Else
txt_bvalue.Enabled = True
End If
lbl_status.Caption = "查询图书记录字段."
txt_bvalue.Text = ""
End Sub

Private Sub cmb_mfield_click()
If (cmb_mfield.Text = "所有") Then
txt_mvalue.Enabled = False
Else
txt_mvalue.Enabled = True
End If
txt_mvalue.Text = ""
lbl_status.Caption = " 查询读者记录字段."
End Sub
Private Sub cmd_bsearch_Click()
On eror GoTo errlable:
'write code for validity
again:
bpbar.Value = 0
If (cmb_bfield.Text = "所有" Or txt_bvalue.Text = "") Then
fnd = "select Author1,Author2,Author3,Avano,Bookid,Edition,ISBNNumber,Issno,Pages,Price,Publication,Subject,Title,Totalno from Book order by Bookid"
lbl_status.Caption = " 查询图书所有记录数据."
bpbar.Value = 30
ElseIf (cmb_bfield.Text = "作者") Then
fnd = "select Author1,Author2,Author3,Avano,Bookid,Edition,ISBNNumber,Issno,Pages,Price,Publication,Subject,Title,Totalno from Book where Author1 like'" & Trim(txt_bvalue.Text) & "%' or Author2 like'" & Trim(txt_bvalue.Text) & "%' or Author3 like'" & Trim(txt_bvalue.Text) & "%'"
lbl_status.Caption = " 查询图书的作者字段."
bpbar.Value = 30
ElseIf (cmb_bfield.Text = "书号") Then
fnd = "select Author1,Author2,Author3,Avano,Bookid,Edition,ISBNNumber,Issno,Pages,Price,Publication,Subject,Title,Totalno from Book where Bookid like'" & Trim(txt_bvalue.Text) & "%'"
lbl_status.Caption = " 查询图书的书号字段."
bpbar.Value = 30
ElseIf (cmb_bfield.Text = "书名") Then
fnd = "select Author1,Author2,Author3,Avano,Bookid,Edition,ISBNNumber,Issno,Pages,Price,Publication,Subject,Title,Totalno from Book where Title like'" & Trim(txt_bvalue.Text) & "%'"
lbl_status.Caption = " 查询图书的书名字段."
bpbar.Value = 30
ElseIf (cmb_bfield.Text = "出版社") Then
fnd = "select Author1,Author2,Author3,Avano,Bookid,Edition,ISBNNumber,Issno,Pages,Price,Publication,Subject,Title,Totalno from Book where Publication like'" & Trim(txt_bvalue.Text) & "%'"
lbl_status.Caption = " 查询图书的出版社字段."
bpbar.Value = 30
ElseIf (cmb_bfield.Text = "ISBN号") Then
fnd = "select Author1,Author2,Author3,Avano,Bookid,Edition,ISBNNumber,Issno,Pages,Price,Publication,Subject,Title,Totalno from Book where ISBNNumber like'" & Trim(txt_bvalue.Text) & "%'"
lbl_status.Caption = " 查询图书的ISBN号字段."
bpbar.Value = 30
ElseIf (cmb_bfield.Text = "类型") Then
fnd = "select Author1,Author2,Author3,Avano,Bookid,Edition,ISBNNumber,Issno,Pages,Price,Publication,Subject,Title,Totalno from Book where Subject like'" & Trim(txt_bvalue.Text) & "%'"
lbl_status.Caption = " 查询图书的类型字段."
bpbar.Value = 30
ElseIf (cmb_bfield.Text = "定价") Then
fnd = "select Author1,Author2,Author3,Avano,Bookid,Edition,ISBNNumber,Issno,Pages,Price,Publication,Subject,Title,Totalno from Book where Price like'" & Trim(txt_bvalue.Text) & "%'"
lbl_status.Caption = " 查询图书的价格字段."
bpbar.Value = 30
ElseIf (cmb_bfield.Text = "页数") Then
fnd = "select Author1,Author2,Author3,Avano,Bookid,Edition,ISBNNumber,Issno,Pages,Price,Publication,Subject,Title,Totalno from Book where Pages like'" & Trim(txt_bvalue.Text) & "%'"
lbl_status.Caption = " 查询图书的页数字段."
bpbar.Value = 30
ElseIf (cmb_bfield.Text = "版次") Then
fnd = "select Author1,Author2,Author3,Avano,Bookid,Edition,ISBNNumber,Issno,Pages,Price,Publication,Subject,Title,Totalno from Book where Edition like'" & Trim(txt_bvalue.Text) & "%'"
lbl_status.Caption = " 查询图书的版次字段."
bpbar.Value = 30

End If
 If (bflag = False) Then
            BR.Open fnd, conn, adOpenStatic, adLockOptimistic
            bpbar.Value = 50
            bdatagrid.Visible = True
            Set bdatagrid.DataSource = BR
            bpbar.Value = 70
            bdatagrid.ReBind
            bflag = True
            bpbar.Value = 85
            Else
            bflag = False
            BR.Close
            GoTo again
            bpbar.Value = 90
              End If
bpbar.Value = 100
bpbar.Value = 0
Exit Sub
errlable:
bpbar.Value = 0
MsgBox Err.Description
End Sub

Private Sub Form_Load()
 On Error GoTo errlable
      If (view = 1) Then
     Me.Top = 50
     Me.Left = 50
     ElseIf (view = 2) Then
     Me.Top = 700
     Me.Left = (Screen.Width - Me.Width) / 2
     End If
'Image1.Picture = mdi_start.ImageList1.ListImages(2).Picture
 Set conn = New ADODB.Connection
 conn.CursorLocation = adUseClient
 conn.ConnectionString = "DSN=library;UID=sa;PWD=;"
 conn.Open
Set BR = New ADODB.Recordset
Set MR = New ADODB.Recordset
 lbl_status.Caption = " 为数据源选择字段选项,为查询指定赋值条件."
Exit Sub
errlable:
MsgBox Err.Number & "  " & Err.Description
End Sub

Private Sub Form_Unload(Cancel As Integer)
Unload Me
End Sub


Private Sub txt_msearch_Click()
'write a code validity
On Error GoTo errlable
again:
 mpbar.Value = 0
 lbl_status.Caption = "查询读者的" & Trim(cmb_mfield.Text) & " 字段."
If (cmb_mfield.Text = "所有" Or txt_mvalue.Text = "") Then
 fnd = "select Address,Birthdate,Bookinhand,Deposite,Doexpire,Dojoin,Email,Mname,Memid,Noted,Phone,Sex from Member Order by Memid"
 lbl_status.Caption = " 查询读者所有记录数据."
mpbar.Value = 40
ElseIf (cmb_mfield.Text = "姓名") Then
 fnd = "select Address,Birthdate,Bookinhand,Deposite,Doexpire,Dojoin,Email,Mname,Memid,Noted,Phone,Sex from Member where Mname like '" & Trim(txt_mvalue.Text) & "%'"
mpbar.Value = 40
ElseIf (cmb_mfield.Text = "借书证号") Then
 fnd = "select Address,Birthdate,Bookinhand,Deposite,Doexpire,Dojoin,Email,Mname,Memid,Noted,Phone,Sex from Member where Memid=" & Trim(txt_mvalue.Text)
mpbar.Value = 40
ElseIf (cmb_mfield.Text = "地址") Then
 fnd = "select Address,Birthdate,Bookinhand,Deposite,Doexpire,Dojoin,Email,Mname,Memid,Noted,Phone,Sex from Member where Address like '" & Trim(txt_mvalue.Text) & "%'"
mpbar.Value = 40
ElseIf (cmb_mfield.Text = "联系电话") Then
 fnd = "select Address,Birthdate,Bookinhand,Deposite,Doexpire,Dojoin,Email,Mname,Memid,Noted,Phone,Sex from Member where Phone like'" & Trim(txt_mvalue.Text) & "%'"
mpbar.Value = 40
ElseIf (cmb_mfield.Text = "电子邮箱") Then
 fnd = "select Address,Birthdate,Bookinhand,Deposite,Doexpire,Dojoin,Email,Mname,Memid,Noted,Phone,Sex from Member where Email like'" & Trim(txt_mvalue.Text) & "%'"
mpbar.Value = 40
ElseIf (cmb_mfield.Text = "出生日期") Then
 fnd = "select Address,Birthdate,Bookinhand,Deposite,Doexpire,Dojoin,Email,Mname,Memid,Noted,Phone,Sex from Member where Birthdate like'" & Trim(txt_mvalue.Text) & "%'"
mpbar.Value = 40
ElseIf (cmb_mfield.Text = "加入时间") Then
 fnd = "select Address,Birthdate,Bookinhand,Deposite,Doexpire,Dojoin,Email,Mname,Memid,Noted,Phone,Sex from Member where Dojoin like'" & Trim(txt_mvalue.Text) & "%'"
mpbar.Value = 40
End If
 If (mflag = False) Then
            MR.Open fnd, conn, adOpenStatic, adLockOptimistic
            mpbar.Value = 65
            mdatagrid.Visible = True
            Set mdatagrid.DataSource = MR
            mpbar.Value = 80
            mdatagrid.ReBind
            mflag = True
            mpbar.Value = 90
            Else
            mflag = False
            MR.Close
            GoTo again
              End If
mpbar.Value = 100
mpbar.Value = 0
Exit Sub
errlable:
mpbar.Value = 0
MsgBox Err.Number & "  " & Err.Description
End Sub

⌨️ 快捷键说明

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