5、 IsEof方法
IsEof方法是用来判断是否还有更多的信息
其代码如下
Private Function IsEof() As Boolean
IsEof = RecordSetCD.EOF
End Function
6、 NextCD 方法
NextCD方法的目的是返回当前的CD信息,并将记录集的指针向下移动,这可以通过MoveNext方法和IsEof配合使用来实现
Private Sub NextCD(Id As Variant, Name As Variant, Author As Variant, Price As Variant, Information As Variant)
On Error Resume Next
If IsEof = True Then
Err.Raise vbObject + 1, "CD Information", "End of cursor"
Exit Sub
End If
Id = RecordSetCD.Fields("CD_ID")
Name = RecordSetCD.Fields("CD_Name")
Author = RecordSetCD.Fields("CD_Author")
Price = RecordSetCD.Fields("CD_Price")
Information = RecordSetCD.Fields("CD_Information")
RecordSetCD.MoveNext
End Sub
好,我们已经编写好了组件,把它们编译成CD.dll后,你最好把他们注册一下 方法是在DOS界面下,输入regsvr32 CD.dll
IsEof方法是用来判断是否还有更多的信息
其代码如下
Private Function IsEof() As Boolean
IsEof = RecordSetCD.EOF
End Function
6、 NextCD 方法
NextCD方法的目的是返回当前的CD信息,并将记录集的指针向下移动,这可以通过MoveNext方法和IsEof配合使用来实现
Private Sub NextCD(Id As Variant, Name As Variant, Author As Variant, Price As Variant, Information As Variant)
On Error Resume Next
If IsEof = True Then
Err.Raise vbObject + 1, "CD Information", "End of cursor"
Exit Sub
End If
Id = RecordSetCD.Fields("CD_ID")
Name = RecordSetCD.Fields("CD_Name")
Author = RecordSetCD.Fields("CD_Author")
Price = RecordSetCD.Fields("CD_Price")
Information = RecordSetCD.Fields("CD_Information")
RecordSetCD.MoveNext
End Sub
好,我们已经编写好了组件,把它们编译成CD.dll后,你最好把他们注册一下 方法是在DOS界面下,输入regsvr32 CD.dll