You need to create a disconnected recordset.
Basic structure of a disconnected recordset:
'-------------------Start Code----------------------------
'Create the Disconnected Recordset
Dim RS As Recordset
Set RS = New Recordset
'Setup the Recordset
With RS
'Make sure there is no active connection
.ActiveConnection = Nothing
'Set for client side processing
.CursorLocation = adUseClient
'Single user updates
.LockType = adLockBatchOptimistic
End With
'Add Fields and Values to Recordset
With RS.Fields
.Append "ID", adBSTR
.Append "Company", adBSTR
.Append "Description", adBSTR
End With
'Open the Recordset
RS.Open
'Populate the Data in the Recordset
With RS
.AddNew
.Fields("ID") = "ID123"
.Fields("Company") = "Some Company"
.Fields("Description") = "Description"
End With
'-------------------------End Code---------------------------
--
Chris Hanscom
MVP (Visual Basic)
http://www.veign.com
--
"Agoston Bejo" <gu***@freemail.hu> wrote in message
news:ee**************@TK2MSFTNGP15.phx.gbl...
I would like to use an ADODB.RecordSet object to temporarily store some
data and then iterate through it. Actually it needs to be a RecordSet only
because it is a perfect choice as data structure for what I want to do, I
don't want to actually run queries or update tables with it.
It seems to me, however, that the RecordSet works only if there's a query
behind it. ADO complains about the RecordSet not being open when I try to
add rows by the AddNew function, or try to add fields to it.
Is there a way to use the RecordSet without actual database date behind
it? Or is there maybe some object in VBScript that provides the same or at
least similar functionality? (Apart from Scripting.Dictionary, which is great,
but I would like to use something more similar. :) )