Results 1 to 2 of 2

Thread: Using connectionless recordsets...

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Posts
    4

    Cool

    Hey everyone -
    Anyone have much experience with connectionless ADO recordsets? (i.e. one where YOU put the data in it instead of the database engine)
    For a vb / internet COM object project, I'm generating a report which requires a lot of processing of data, resorting, and processing again in order to get the data massaged as I need it for the report.
    I've tried the steps in several guide sbut nothing seems to work and I'm thinking one small thing is wrong. The problem that occurs is that no matter what I try, when I add a second or third record to the recordset, they just overwrite the first and then the recordset only has one record in it.

    Here's the code I've tried:

    Dim rs As Recordset 'Create recordset
    Set rs = New Recordset

    With rs 'Setup column names
    .Fields.Append "Name", adBSTR
    .Fields.Append "BirthDate", adDate
    End With

    rs.Open 'Open Recordset

    With rs 'Add one record
    .AddNew
    .Fields("Name") = "Fred"
    .Fields("BirthDate") = "1/1/88"
    .Update
    End With

    'rs.MoveNext <-- this was tried but didn't work

    With rs 'Add another record
    .AddNew
    .Fields("Name") = "Mary"
    .Fields("BirthDate") = "3/10/68"
    .Update
    End With

    aData = rs.GetRows 'Stick all this data
    Set rs = Nothing ' in an array
    Debug.Print "Done."
    =========================
    George Walley
    Northwestern, University
    Chicago, IL

  2. #2

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Posts
    4

    Talking Nevermind - I figured it out...

    I knew it was something basic...

    If you've been adding records to a recordset and then want
    to use the .GetRows() method on the recordset to store the
    whole thing in an array, be SURE to first call .MoveFirst()!

    Otherwise, it will output all the rows from that point on,
    but will not fetch previous records... geesh.
    =========================
    George Walley
    Northwestern, University
    Chicago, IL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width