Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2004
    Posts
    3

    Unanswered: A little help with ADO Recordset

    Hello, I need to know whether is it possible to copy the contents of an ADO recordset into another ADO recordset using VB 6?

    I would really appreciate whatever help I can get on this....

  2. #2
    Join Date
    Feb 2004
    Posts
    199
    recordset isn't just array to copy it (unless it's snapshot type).
    Dynamic recordset is just pointer to a Table/View Row and there is no sence to copy it. you can create pointer copies , as mach as you need , but why do you need copy of the recordset?
    MDB, ADP <-> MS SQL + VBA, ADO & RDO, .NET, Oracle, Java/Jsp.

  3. #3
    Join Date
    Jan 2004
    Posts
    184

    Re: A little help with ADO Recordset

    Yes you can, do this:

    Set Recordset2 = Recordset1.Clone
    In abundance of water only the fool is thirsty. Bob Marley.

  4. #4
    Join Date
    Mar 2004
    Posts
    3

    Question Re: A little help with ADO Recordset

    Thanks for the reply but it wasn't what I wanted.

    The solution you gave me merely made a copy of the recordset but what I really wanted was to copy all the data represented by the ADO recordset into another table.

    I'm currently using a datagrid to display the recordset and I was hoping that I could save all that data into another table represented by another recordset. On top of that, I need to append the data from the first table which is acting as a temporary table into the second table which is the master for all the data.

    Is there really no way to copy the whole thing?

  5. #5
    Join Date
    Jan 2004
    Posts
    184

    Re: A little help with ADO Recordset

    In that case cycle through your recordset while inserting the data into a table. i.e.

    do while not rs.eof

    connection.execute "INSERT Table2(field1, field2) SELECT '" & rs.fields("field1") & "','" & rs.fields("field2") & "'"

    rs.movenext

    Loop
    In abundance of water only the fool is thirsty. Bob Marley.

  6. #6
    Join Date
    Mar 2004
    Posts
    3

    Thumbs up

    Thanks a lot! That worked wonderfully.

Posting Permissions

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