📄 sbook.frm
字号:
Caption = "更新(&U)"
Height = 300
Left = 1800
TabIndex = 3
Top = 0
Width = 1095
End
Begin VB.CommandButton cmdAdd
Caption = "添加(&A)"
Height = 300
Left = 720
TabIndex = 2
Top = 0
Width = 1095
End
End
Begin MSAdodcLib.Adodc datPrimaryRS
Height = 330
Left = -240
Top = 5160
Visible = 0 'False
Width = 1380
_ExtentX = 2434
_ExtentY = 582
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 = "PROVIDER=MSDataShape;Data PROVIDER=Microsoft.Jet.OLEDB.3.51;Data Source=libary.mdb;"
OLEDBString = "PROVIDER=MSDataShape;Data PROVIDER=Microsoft.Jet.OLEDB.3.51;Data Source=libary.mdb;"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = $"sbook.frx":1086
Caption = " "
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
Begin MSDataGridLib.DataGrid grdDataGrid
Height = 2535
Left = 120
TabIndex = 0
Top = 2400
Width = 6105
_ExtentX = 10769
_ExtentY = 4471
_Version = 393216
AllowUpdate = 0 'False
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
Caption = "借阅状况"
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
End
Attribute VB_Name = "sbook"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'书籍信息查询的实现,(为了数据更新的方便)
Private Sub begin_Click()
Select Case combo1.ListIndex
Case 0
datPrimaryRS.Recordset.Find "书号 ='" & Text1.Text & "'", 1
If datPrimaryRS.Recordset.EOF Then
datPrimaryRS.Recordset.MoveFirst
datPrimaryRS.Recordset.Find "书号 ='" & Text1.Text & "'"
End If
Case 1
datPrimaryRS.Recordset.Find "名称 ='" & Text1.Text & "'", 1
If datPrimaryRS.Recordset.EOF Then
datPrimaryRS.Recordset.MoveFirst
datPrimaryRS.Recordset.Find "名称='" & Text1.Text & "'"
End If
Case 2
datPrimaryRS.Recordset.Find "作者 ='" & Text1.Text & "'", 1
If datPrimaryRS.Recordset.EOF Then
datPrimaryRS.Recordset.MoveFirst
datPrimaryRS.Recordset.Find "作者 ='" & Text1.Text & "'"
End If
Case 3
datPrimaryRS.Recordset.Find "出版社 ='" & Text1.Text & "'", 1
If datPrimaryRS.Recordset.EOF Then
datPrimaryRS.Recordset.MoveFirst
datPrimaryRS.Recordset.Find "出版社 ='" & Text1.Text & "'"
End If
Case 4
datPrimaryRS.Recordset.Find "出版时间='" & Text1.Text & "'", 1
If datPrimaryRS.Recordset.EOF Then
datPrimaryRS.Recordset.MoveFirst
datPrimaryRS.Recordset.Find "出版时间 ='" & Text1.Text & "'"
End If
End Select
End Sub
'------此处用的是VB数据向导生成的窗体------
Private Sub cmdFirst_Click()
On Error GoTo GoLastError
datPrimaryRS.Recordset.MoveFirst
Exit Sub
GoLastError:
MsgBox Err.Description
End Sub
Private Sub cmdLast_Click()
On Error GoTo GoLastError
datPrimaryRS.Recordset.MoveLast
Exit Sub
GoLastError:
MsgBox Err.Description
End Sub
Private Sub cmdNext_Click()
On Error GoTo GoLastError
If Not datPrimaryRS.Recordset.EOF Then
datPrimaryRS.Recordset.MoveNext
Else
datPrimaryRS.Recordset.MoveFirst
End If
Exit Sub
GoLastError:
MsgBox Err.Description
End Sub
Private Sub cmdPrevious_Click()
On Error GoTo GoLastError
If Not datPrimaryRS.Recordset.BOF Then
datPrimaryRS.Recordset.MovePrevious
Else
datPrimaryRS.Recordset.MoveLast
End If
Exit Sub
GoLastError:
MsgBox Err.Description
End Sub
Private Sub Form_Load()
On Error GoTo wrong
Me.Icon = Form1.Icon
Left = (Screen.Width - Me.Width) \ 2
Top = (Screen.Height - Me.Height) \ 2
Set grdDataGrid.DataSource = datPrimaryRS.Recordset("ChildCMD").UnderlyingValue '建立表libary和sbook之间的联系
Exit Sub
wrong:
MsgBox Err.Description
End Sub
Private Sub Form_Resize()
On Error Resume Next
'当窗体调整时会调整网格
grdDataGrid.Width = Me.ScaleWidth - 200
grdDataGrid.Height = Me.ScaleHeight - grdDataGrid.Top '
End Sub
Private Sub Form_Unload(cancel As Integer)
Screen.MousePointer = vbDefault
End Sub
Private Sub datPrimaryRS_Error(ByVal ErrorNumber As Long, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, fCancelDisplay As Boolean)
'错误处理程序代码置于此处
'想要忽略错误,注释掉下一行
'想要捕获它们,在此添加代码以处理它们
MsgBox "Data error event hit err:" & Description
End Sub
Private Sub cmdAdd_Click()
On Error GoTo AddErr
datPrimaryRS.Recordset.AddNew
Exit Sub
AddErr:
MsgBox Err.Description
End Sub
Private Sub cmdDelete_Click()
On Error GoTo DeleteErr
With datPrimaryRS.Recordset
.Delete
.MoveNext
If .EOF Then .MoveLast
End With
Exit Sub
DeleteErr:
MsgBox Err.Description
End Sub
Private Sub cmdUpdate_Click()
On Error GoTo UpdateErr
datPrimaryRS.Recordset.UpdateBatch adAffectAll
Exit Sub
UpdateErr:
MsgBox Err.Description
End Sub
Private Sub cmdClose_Click()
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -