I was wondering does anyone know how to create a recordset in memory, or know of a website that
would show me how to do this sort of procedure.
T.I.A.,
Ronald K. Rex
T.I.A.,
Ronald K. Rex
I think what you are looking for is called Creatable Recordsets.
This is some sample code I got from the MDAC SDK 2.1 help files:
Dim Rst As New ADODB.Recordset
Rst.CursorLocation = adUseClient
'Add Some Fields
Rst.Fields.Append "dbkey", adInteger
Rst.Fields.Append "field1", adVarChar, 40, adFldIsNullable
Rst.Fields.Append "field2", adDate
'Create the Recordset
Rst.Open , , adOpenStatic, adLockBatchOptimistic
'Add Some Rows
Rst.AddNew Array("dbkey", "field1", "field2"), _
Array(1, "string1", Date)
Rst.AddNew Array("dbkey", "field1", "field2"), _
Array(2, "string2", #1/6/1992#)
'Look at the values - a value of 1 for status column = newly record
Rst.MoveFirst
Debug.Print "Status", "dbkey", "field1", "field2"
While Rst.EOF <> True
Debug.Print Rst.Status, Rst!dbkey, Rst!field1, Rst!field2
Rst.MoveNext
Wend
'Commit the rows without ActiveConnection set resets the status bits
Rst.UpdateBatch adAffectAll
'Change the first of the two rows
Rst.MoveFirst
Rst!field1 = "changed"
'Now look at the status, first row shows 2 (modified row),
'second shows 8 (no modifications)
'Also note that the OriginalValue property shows the value
'before the modification
Rst.MoveFirst
While Rst.EOF <> True
Debug.Print
Debug.Print Rst.Status, Rst!dbkey, Rst!field1, Rst!field2
Debug.Print , Rst!dbkey.OriginalValue, _
Rst!field1.OriginalValue, Rst!field2.OriginalValue
Rst.MoveNext
Wend
--
Regards
VB-Joker
Carsten Thomsen/MCSE
PLEASE post ALL replies to the newsgroup(s) so we can all benefit from the
discussion!
know of a website thatQuote:> I was wondering does anyone know how to create a recordset in memory, or
Quote:> would show me how to do this sort of procedure.
> T.I.A.,
> Ronald K. Rex
1. how to create a recordset in memory?
I want to create a temporary recordset in memory with my
own fields. I don't want it connected to my database. I
remember seeing the code somewhere, but I can't find it again.
Can someone show me or point me in the right direction?
Thanks,
Greg
2. to import an access 2000 database into sql7
3. Create RecordSet in memory ONLY?
4. kNN serach in SQL 2000 Analysis Services
5. Is this a job for replication?
6. creating recordset in memory?
8. Connected Recordset adPersistXML differs from Disconnected Recordset built in-memory
9. CREATE DATABASE creates "memory leak"
10. Creating a new recordset from an existing recordset
11. How do I create a recordset based on another recordset
12. How do I create a recordset based on an existing recordset