📄 frmfindreaderinfo.frm
字号:
VERSION 5.00
Begin VB.Form frmfindreaderinfo
Caption = "查询读者信息"
ClientHeight = 6000
ClientLeft = 60
ClientTop = 450
ClientWidth = 9135
LinkTopic = "Form1"
ScaleHeight = 6000
ScaleWidth = 9135
StartUpPosition = 2 '屏幕中心
Begin VB.PictureBox DataGrid1
Height = 3855
Left = 240
ScaleHeight = 3795
ScaleWidth = 8715
TabIndex = 8
Top = 1800
Width = 8775
End
Begin VB.CommandButton Command2
Caption = "取消"
Height = 495
Left = 4800
TabIndex = 7
Top = 960
Width = 1455
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 495
Left = 2520
TabIndex = 6
Top = 960
Width = 1455
End
Begin VB.ComboBox Combo1
Height = 300
Left = 7440
TabIndex = 5
Text = "Combo1"
Top = 360
Width = 1455
End
Begin VB.TextBox Text2
Height = 375
Left = 4440
TabIndex = 4
Top = 360
Width = 1695
End
Begin VB.TextBox Text1
Height = 375
Left = 1440
TabIndex = 3
Top = 360
Width = 1695
End
Begin VB.CheckBox Check3
Caption = "读者种类"
Height = 495
Left = 6240
TabIndex = 2
Top = 240
Width = 1095
End
Begin VB.CheckBox Check2
Caption = "读者姓名"
Height = 495
Left = 3240
TabIndex = 1
Top = 240
Width = 1095
End
Begin VB.CheckBox Check1
Caption = "读者编号"
Height = 495
Left = 240
TabIndex = 0
Top = 240
Width = 1095
End
End
Attribute VB_Name = "frmfindreaderinfo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim rs_findreader As New ADODB.Recordset
Dim conn As New ADODB.Connection
Dim sql As String
If Check1.Value = vbChecked Then
sql = "读者编号='" & Trim(Text1.Text & "") & "'"
End If
If Check2.Value = vbChecked Then
If Trim(sql) = "" Then
sql = "读者姓名='" & Trim(Text2.Text & " ") & "'"
Else
sql = sql & "and 类别='" & Trim(Text2.Text & " ") & "'"
End If
End If
If Check3.Value = vbChecked Then
If Trim(sql) = "" Then
sql = "读者类别='" & Trim(Combo1.Text & " ") & "'"
Else
sql = sql & "and 读者类别='" & Trim(Combo1.Text & " ") & "'"
End If
End If
conn.Open "provider=Microsoft.Jet.OLEDB.4.0; data source=" & App.Path & "\database.mdb"
If Trim(sql) = "" Then
MsgBox "请选择查询方式!", vbOKOnly + vbExclamation
Exit Sub
End If
sql = "select * from 读者信息 where " & sql
rs_findreader.CursorLocation = adUseClient
rs_findreader.Open sql, conn, adOpenKeyset, adLockPessimistic
DataGrid1.AllowAddNew = False
DataGrid1.AllowDelete = False
DataGrid1.AllowUpdate = False
If rs_findreader.RecordCount = 0 Then
MsgBox "查询不到该图书信息!", vbOKOnly + vbExclamation
Else
Set DataGrid1.DataSource = rs_findreader
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Dim rs_find As New ADODB.Recordset
Dim conn As New ADODB.Connection
Dim sql As String
sql = "select * from 读者类别"
conn.Open "provider=Microsoft.Jet.OLEDB.4.0; data source=" & App.Path & "\database.mdb"
rs_find.Open sql, conn, adOpenKeyset, adLockPessimistic
rs_find.MoveFirst
If Not rs_find.EOF Then
Do While Not rs_find.EOF
Combo1.AddItem rs_find.Fields(0)
rs_find.MoveNext
Loop
Combo1.ListIndex = 0
End If
rs_find.Close
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -