如何能让一个查询到的记录集能在整个工程中使用??
我在模块中定义了这个通用的记录集
Option Explicit
Public db As Database, db2 As Database, rs1 As Recordset, rs2 As Recordset, qr As QueryDef, qr2 As QueryDef
Public myrs As Recordset
我再把一个窗体里查询到的记录进行赋值
却会报错。。。
Private Sub Form_Load()
Dim a
Dim i As Integer
Dim rs As New ADODB.Recordset '写入数据库是OK的
Dim cn As New ADODB.Connection
Dim strCn As String, strSQL As String
strCn = "Provider=sqloledb;server=.;Database=sxcpmc;Uid=sa;Pwd=;"
cn.Open strCn
rs.Open "select * from user1", cn, adOpenKeyset, adLockOptimistic
myrs = rs 这句会报错“属性的使用无效”
MsgBox "OK,打开了记录集"