Public Property Get 测试() As ADODB.Recordset Dim rs As New ADODB.Recordset rs.Open sql, cnns, adOpenForwardOnly, adLockReadOnly Set 测试 = rs
End PropertyPublic Property Let 测试(ByVal vNewValue As ADODB.Recordset)
End Property
ymize(不知所。云) 你也用类生成器?自己写的吗?
可以的类模块 Dim rs As New ADODB.Recordset Public Property Get MyProperty() As ADODB.Recordset MyProperty = rs End PropertyPublic Property Let MyProperty(ByRef vNewRecordset As ADODB.Recordset) Set rs = vNewRecordset End Property窗体 Private Sub Command1_Click() Dim rs As New ADODB.Recordset Dim myobj As New Class1 myobj.MyProperty = rs End Sub编译通过! msn:[email protected]
但是我想应该可以!!
这个类型啊
Public Property Get 测试() As ADODB.Recordset
Dim rs As New ADODB.Recordset
rs.Open sql, cnns, adOpenForwardOnly, adLockReadOnly
Set 测试 = rs
End PropertyPublic Property Let 测试(ByVal vNewValue As ADODB.Recordset)
End Property
Dim rs As New ADODB.Recordset
Public Property Get MyProperty() As ADODB.Recordset
MyProperty = rs
End PropertyPublic Property Let MyProperty(ByRef vNewRecordset As ADODB.Recordset)
Set rs = vNewRecordset
End Property窗体
Private Sub Command1_Click()
Dim rs As New ADODB.Recordset
Dim myobj As New Class1
myobj.MyProperty = rs
End Sub编译通过!
msn:[email protected]
hewei2003()兄!
你直接把rs赋给myobj.MyProperty ?
可以不用set吗?
在菜单的 工程--》引用,在Micrsoft ActiveX Data Objects 2.0 Labrary前打钩
或是 Micrsoft ActiveX Data Objects 2.1 Labrary、Micrsoft ActiveX Data Objects 2.5 Labrary、Micrsoft ActiveX Data Objects 2.6 Labrary.....
版本越高越好。
偶说的是在类生成器中定义属性的时候
数据类型选择中没有adodb.recordset
这些类型