?? sbook.frm
字號:
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 datPrimaryRS_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
'為這個 recordset 顯示當前記錄位置
datPrimaryRS.Caption = "Record: " & CStr(datPrimaryRS.Recordset.AbsolutePosition)
End Sub
Private Sub datPrimaryRS_WillChangeRecord(ByVal adReason As ADODB.EventReasonEnum, ByVal cRecords As Long, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
'驗證代碼置于此處
'下列動作發生時該事件被調用
Dim bCancel As Boolean
Select Case adReason
Case adRsnAddNew
Case adRsnClose
Case adRsnDelete
Case adRsnFirstChange
Case adRsnMove
Case adRsnRequery
Case adRsnResynch
Case adRsnUndoAddNew
Case adRsnUndoDelete
Case adRsnUndoUpdate
Case adRsnUpdate
End Select
If bCancel Then adStatus = adStatusCancel
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 + -