Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 VB6 - How to add 2 recordsets togeather

Author  Topic 

tleal
Starting Member

4 Posts

Posted - 2003-03-10 : 20:02:38
VB6 using ADO.
I have 2 recordsets that have the same structure, Does anyone know how to add 2 recordsets togeather. I'm trying not create a temp table.

robvolk
Most Valuable Yak

15732 Posts

Posted - 2003-03-10 : 20:17:51
Don't know why, it would be a lot easier to use a temp table to collect the results into one table. If you've already gotten both sets of data into ADO recordsets, it doesn't make much sense to try to combine them into one.

Go to Top of Page

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2003-03-10 : 21:06:31
What about a UNION in your query ?

Damian
Go to Top of Page

sherrer

64 Posts

Posted - 2003-03-11 : 15:34:28

Dim oField as ADODB.Field
Do While Not OrigRecordset.EOF
rs.AddNew
For Each oField In OrigRecordset.Fields
rs.Fields.Item(oField.Name) = oField.Value
Next
OrigRecordset.MoveNext
Loop

This assumes that your recordset structure is the same or at least rs is a subset of the original. You can either use ado method clone to create a new recordset to add to or you can add one recordset to another.

I think your best bet is to take Damian's advise and use a UNION.

Kevin

Go to Top of Page

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2003-03-12 : 06:56:02
What does it mean to add two recordsets together? Is that new math?

Jay White
{0}
Go to Top of Page
   

- Advertisement -