干嘛要用new? 直接Dim RS() As adodc.recordset不行吗? 不过我也不知道这样行不行,没试过,你可试试看
一个就可以呀这样就相当于一个纪录集数组呀: dim rs as new adodb.recordset rs.open "select * from t1;select * from t2;select * from t3",cn 然后使用rs.nextrecordset 你可以察看一下帮助
NextRecordset 方法范例 该范例使用 NextRecordset 方法,查看使用了由三个独立 SELECT 语句组成的复合命令语句的记录集中的数据。Public Sub NextRecordsetX() Dim rstCompound As ADODB.Recordset Dim strCnn As String Dim intCount As Integer ' 打开复合记录集。 strCnn = "Provider=sqloledb;" & _ "Data Source=srv;Initial Catalog=pubs;User Id=sa;Password=; "
Set rstCompound = New ADODB.Recordset rstCompound.Open "SELECT * FROM authors; " & _ "SELECT * FROM stores; " & _ "SELECT * FROM jobs", strCnn, , , adCmdText ' 显示每一个 SELECT 语句的结果。 intCount = 1 Do Until rstCompound Is Nothing Debug.Print "Contents of recordset #" & intCount Do While Not rstCompound.EOF Debug.Print , rstCompound.Fields(0), _ rstCompound.Fields(1) rstCompound.MoveNext Loop
Set rstCompound = rstCompound.NextRecordset intCount = intCount + 1 Loop
End Sub
是这样的: 我做了一个多线程的程序。每个线程都要调用一个过程OPmainsub OPmain dim Rs as new adodb.recordsetif Rs.state = 1 then Rs.close end if Rs.open"........",Cnend sub当一个线程运行到Rs.open"........",Cn时,另一个线程正好运行到Rs.close 这样第一个线程就不能运行了。所以我想建立一组记录集。 大家帮我想想该怎么做!!
直接Dim RS() As adodc.recordset不行吗?
不过我也不知道这样行不行,没试过,你可试试看
dim rs as new adodb.recordset
rs.open "select * from t1;select * from t2;select * from t3",cn
然后使用rs.nextrecordset
你可以察看一下帮助
该范例使用 NextRecordset 方法,查看使用了由三个独立 SELECT 语句组成的复合命令语句的记录集中的数据。Public Sub NextRecordsetX() Dim rstCompound As ADODB.Recordset
Dim strCnn As String
Dim intCount As Integer ' 打开复合记录集。
strCnn = "Provider=sqloledb;" & _
"Data Source=srv;Initial Catalog=pubs;User Id=sa;Password=; "
Set rstCompound = New ADODB.Recordset
rstCompound.Open "SELECT * FROM authors; " & _
"SELECT * FROM stores; " & _
"SELECT * FROM jobs", strCnn, , , adCmdText ' 显示每一个 SELECT 语句的结果。
intCount = 1
Do Until rstCompound Is Nothing
Debug.Print "Contents of recordset #" & intCount
Do While Not rstCompound.EOF
Debug.Print , rstCompound.Fields(0), _
rstCompound.Fields(1)
rstCompound.MoveNext
Loop
Set rstCompound = rstCompound.NextRecordset
intCount = intCount + 1
Loop
End Sub
我做了一个多线程的程序。每个线程都要调用一个过程OPmainsub OPmain
dim Rs as new adodb.recordsetif Rs.state = 1 then
Rs.close
end if
Rs.open"........",Cnend sub当一个线程运行到Rs.open"........",Cn时,另一个线程正好运行到Rs.close
这样第一个线程就不能运行了。所以我想建立一组记录集。
大家帮我想想该怎么做!!