|
-
Sep 3rd, 2002, 04:20 AM
#1
Thread Starter
Hyperactive Member
Passing records between recordsets
Can I fill an ADO recordset with records from another ADO recordset.
I want to do tests on individual records in a set and those that pass should be sent to another recordset.
I am sure this will be easy I just can't figure it out.
-
Sep 3rd, 2002, 04:36 AM
#2
Bouncy Member
a few questions...
do you want to move or copy the records accross???
do you want to move/copy each record as you assess it...
do you want to do it in bulk, i.e. track which records to copy/move then do them all at once later on..?
also assuming the two recordsets point to different tables/queries then why not just copy the records accross to the underlying table in the second recordset using SQL or something, then at the end of the whole process just refresh the recordset...
-
Sep 3rd, 2002, 04:43 AM
#3
Thread Starter
Hyperactive Member
Originally posted by darre1
do you want to move or copy the records accross??? -
Copy
do you want to move/copy each record as you assess it... -
Yes
do you want to do it in bulk, i.e. track which records to copy/move then do them all at once later on..? -
One at a time
also assuming the two recordsets point to different tables/queries then why not just copy the records accross to the underlying table in the second recordset using SQL or something, then at the end of the whole process just refresh the recordset...
The tests I need to perform cannot be done with SQL, I have a calculation class that converts values (39 of them into 5 different ones) these values are then compared with pre-defined ranges.
-
Sep 3rd, 2002, 07:39 AM
#4
Bouncy Member
how many tests have to be performed...?
for example lets say you have to do 5 tests.
i would personally do it like this.
open the recordset initially with every record in the table.
filter out the records that fail test 1.
then apply another filter on top to filter out the records that fail test 2.
etc etc...
this is more efficient than just doing 1 record at a time, since some of the records wont need to be tested on all of the tests anyway.
once you have applied all filters go through the remaining records and copy them accross either using SQL INSERT INTO statement or you could use rst.AddNew and then set the values that you want to add.
can you give a better example of what you are having trouble with...do you want to copy records to another table???
do the other recordset point to the same table or a different one etc......?
-
Sep 3rd, 2002, 08:31 AM
#5
Thread Starter
Hyperactive Member
I need a recordset to pass to a class that uses it to fill a FlexGrid.
But the recordset I get from the database has too many records, so I want to declare another recordset and only put some of the records from the 1st set into it.
The 2nd recordset will not be connected to a database, it is just a method of holding data temporarily.
-
Sep 3rd, 2002, 09:00 AM
#6
PowerPoster
Well
Can you hold the excess records in an array?
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
-
Sep 3rd, 2002, 09:08 AM
#7
Thread Starter
Hyperactive Member
Re: Well
Originally posted by James Stanich
Can you hold the excess records in an array?
Yes I could but I was hoping there would be a lazy way.
-
Sep 3rd, 2002, 09:13 AM
#8
PowerPoster
Re: Re: Well
Originally posted by GlenW
Yes I could but I was hoping there would be a lazy way.
The solution is not always a simple one. Sorry.
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
-
Sep 3rd, 2002, 09:25 AM
#9
Bouncy Member
in that case instead of using 2 recordsets, why not just use one with lots of filters in that you then send to your class?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|