📄 findreader.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form findreader
BorderStyle = 1 'Fixed Single
Caption = "读者查询修改"
ClientHeight = 6705
ClientLeft = 4380
ClientTop = 2580
ClientWidth = 7800
Icon = "findreader.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
ScaleHeight = 6705
ScaleWidth = 7800
Begin VB.Frame Frame4
Caption = "编辑"
Height = 735
Left = 120
TabIndex = 13
Top = 1800
Width = 7575
Begin VB.CommandButton Command5
Caption = "删除"
Enabled = 0 'False
Height = 375
Left = 4560
TabIndex = 15
Top = 240
Width = 1455
End
Begin VB.CommandButton Command4
Caption = "修改"
Enabled = 0 'False
Height = 375
Left = 1440
TabIndex = 14
Top = 240
Width = 1455
End
End
Begin VB.Frame Frame3
Caption = "查询结果"
Height = 3975
Left = 120
TabIndex = 10
Top = 2640
Width = 7575
Begin MSDataGridLib.DataGrid DataGrid1
Bindings = "findreader.frx":2C14A
Height = 3615
Left = 120
TabIndex = 11
Top = 240
Width = 7335
_ExtentX = 12938
_ExtentY = 6376
_Version = 393216
AllowUpdate = 0 'False
BackColor = 12648447
HeadLines = 1
RowHeight = 15
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 2
BeginProperty Column00
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
Begin MSAdodcLib.Adodc Adodc1
Height = 495
Left = 1320
Top = 1920
Visible = 0 'False
Width = 2535
_ExtentX = 4471
_ExtentY = 873
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
End
Begin VB.Frame Frame2
Caption = "查询"
Height = 1695
Left = 3960
TabIndex = 5
Top = 120
Width = 3735
Begin VB.CommandButton Command7
Caption = "关闭"
Height = 375
Left = 2400
TabIndex = 12
Top = 1200
Width = 1095
End
Begin VB.CommandButton Command2
Caption = "清空"
Height = 375
Left = 1320
TabIndex = 9
Top = 1200
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "查询"
Height = 375
Left = 240
TabIndex = 8
Top = 1200
Width = 1095
End
Begin VB.TextBox Text1
BackColor = &H00C0FFFF&
Height = 375
Left = 1680
TabIndex = 7
Top = 360
Width = 1815
End
Begin VB.Label Label1
Alignment = 1 'Right Justify
Caption = "请选择查询方式"
Height = 375
Left = 120
TabIndex = 6
Top = 480
Width = 1455
End
End
Begin VB.Frame Frame1
Caption = "查询方式"
Height = 1695
Left = 120
TabIndex = 0
Top = 120
Width = 3735
Begin VB.OptionButton Option5
Caption = "查看所有读者信息"
Height = 255
Left = 360
TabIndex = 16
Top = 1200
Width = 2175
End
Begin VB.OptionButton Option4
Caption = "按办证日期查询"
Height = 375
Left = 1920
TabIndex = 4
Top = 720
Width = 1575
End
Begin VB.OptionButton Option3
Caption = "按单位查询"
Height = 375
Left = 360
TabIndex = 3
Top = 720
Width = 1335
End
Begin VB.OptionButton Option2
Caption = "按姓名查询"
Height = 375
Left = 1920
TabIndex = 2
Top = 240
Width = 1575
End
Begin VB.OptionButton Option1
Caption = "按编号查询"
Height = 375
Left = 360
TabIndex = 1
Top = 240
Width = 1455
End
End
End
Attribute VB_Name = "findreader"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Command1_Click()
Dim x As String
If Text1.Text = "" Then
MsgBox "请输入查询内容", vbInformation + vbOKOnly, "警告"
Text1.SetFocus
Exit Sub
End If
If Option1.Value = False And Option2.Value = False And Option3.Value = False And Option4.Value = False Then
MsgBox "请选择查询方式", vbInformation + vbOKOnly, "警告"
Option1.Value = True
Exit Sub
End If
If Option1.Value = True Then
x = "select * from readerinfo where 读者编号 in(" + "'" + Text1.Text + "')"
End If
If Option2.Value = True Then
x = "select * from readerinfo where 读者姓名 in(" + "'" + Text1.Text + "')"
End If
If Option3.Value = True Then
x = "select * from readerinfo where 所属单位 in(" + "'" + Text1.Text + "')"
End If
If Option4.Value = True Then
x = "select * from readerinfo where 办证日期 in(#" & Text1.Text & "#)"
End If
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = x
Adodc1.Refresh
If Adodc1.Recordset.RecordCount <= 0 Then
MsgBox "对不起没有你所需要的读者信息!", vbInformation + vbOKOnly, "信息"
Text1.Text = ""
Text1.SetFocus
Command4.Enabled = False
Command5.Enabled = False
Exit Sub
Else
Command4.Enabled = True
Command5.Enabled = True
End If
End Sub
Private Sub Command2_Click()
Option1.Value = False
Option2.Value = False
Option3.Value = False
Option4.Value = False
Option5.Value = False
Text1.Text = ""
End Sub
Private Sub Command4_Click()
If MDIForm1.mfadd.Enabled = False Then
MsgBox "对不起,你的权限不够,不能进行修改操作!", vbInformation + vbOKOnly, "信息"
Exit Sub
Else
editreader.Show
End If
End Sub
Private Sub Command5_Click()
Dim strReadID As String
If MDIForm1.mfadd.Enabled = False Then
MsgBox "对不起,你的权限不够,不能进行删除操作!", vbInformation + vbOKOnly, "信息"
Exit Sub
Else
DataGrid1.Col = 0
strReadID = DataGrid1.Text
If strReadID <> "" Then
Set g_rs = g_db.OpenRecordset("select * from lentinfo ")
Do While Not g_rs.EOF
If g_rs!读者编号 = strReadID Then
MsgBox "对不起,该读者尚有图书未还,不能删除!", vbInformation + vbOKOnly, "警告"
Set g_rs = Nothing
Exit Sub
End If
g_rs.MoveNext
Loop
If MsgBox("是否确定要删除读者编号为" + strReadID + "的信息?", vbInformation + vbOKCancel, "删除") = vbOK Then
With Adodc1.Recordset
.Delete
If .EOF Then
.MoveLast
Else
.MoveNext
End If
End With
MsgBox "编号为" + strReadID + "的信息已经删除!", vbInformation + vbOKOnly, "信息"
Exit Sub
End If
Else
Exit Sub
End If
End If
End Sub
Private Sub Command7_Click()
Unload Me
End Sub
Private Sub Form_Load()
dbl
Option1.Value = False
Option2.Value = False
Option3.Value = False
Option4.Value = False
Option5.Value = False
Adodc1.ConnectionString = "provider=microsoft.jet.oledb.4.0;data source=" _
& App.Path & "\db2.mdb;Mode=ReadWrite;persist security info=true;Jet OLEDB:Database Password=xgg2213"
Adodc1.CursorLocation = adUseClient
End Sub
Private Sub Option1_Click()
Label1.Caption = "按编号查询"
End Sub
Private Sub Option2_Click()
Label1.Caption = "按姓名查询"
End Sub
Private Sub Option3_Click()
Label1.Caption = "按单位查询"
End Sub
Private Sub Option4_Click()
Label1.Caption = "按办证日期查询"
End Sub
Private Sub Option5_Click()
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "select * from readerinfo"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount <= 0 Then
Exit Sub
Else
Command4.Enabled = True
Command5.Enabled = True
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -