If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Delphi, C etc > A little help with ADO Recordset

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-10-04, 06:12
hwdsoo hwdsoo is offline
Registered User
 
Join Date: Mar 2004
Posts: 3
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....
Reply With Quote
  #2 (permalink)  
Old 03-10-04, 06:42
Kakha Kakha is offline
Registered User
 
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.
Reply With Quote
  #3 (permalink)  
Old 03-10-04, 08:30
rami.haddad rami.haddad is offline
Registered User
 
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.
Reply With Quote
  #4 (permalink)  
Old 03-10-04, 10:15
hwdsoo hwdsoo is offline
Registered User
 
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?
Reply With Quote
  #5 (permalink)  
Old 03-10-04, 10:20
rami.haddad rami.haddad is offline
Registered User
 
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.
Reply With Quote
  #6 (permalink)  
Old 03-14-04, 02:28
hwdsoo hwdsoo is offline
Registered User
 
Join Date: Mar 2004
Posts: 3
Thumbs up

Thanks a lot! That worked wonderfully.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On