Re: compare 2 recordsets
- From: "RB Smissaert" <bartsmissaert@xxxxxxxxxxxxxxxx>
- Date: Sat, 29 Sep 2007 13:01:12 +0100
I now have something that does work (and that is a start), but performance is not very good:
rsNode.MoveFirst
Do While rsNode.EOF = False
strCriterium = strParentField & " = " & rsNode.Fields(lNodeField)
If rsParentNode.FindNext(strCriterium) = False Then
rsNode.Delete adAffectCurrent
End If
rsNode.MoveNext
Loop
I think the FindNext method is the problem and maybe this is better with a double loop,
knowing that both recordsets are sorted ascending of the ID field.
RBS
"Bob Barrows [MVP]" <reb01501@xxxxxxxxxxxxxxx> wrote in message news:eaTFtPjAIHA.4584@xxxxxxxxxxxxxxxxxxxxxxx
RB Smissaert wrote:What would be the best (fastest) way to do this:Why are you using recordsets for this? Are the recordsets from different databases?
I have 2 ADO recordsets say A and B.
They both have a common field, say ID
Now I need to delete all the records in recordset A where
the value in the field ID is not found in the field in recordset B.
These are values of the datatype Long.
The ID field will be sorted ascending in both recordsets.
Now, I could do this with a double loop, but that could be a bit slow
and I wonder if this could be done better with a filter or find.
If not, this is a job for SQL.
If so, there's no alternative to looping through one of them, but you can use Filter to get the corresponding records in the other recordset.
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
.
- Follow-Ups:
- Re: compare 2 recordsets
- From: Bob Barrows [MVP]
- Re: compare 2 recordsets
- References:
- compare 2 recordsets
- From: RB Smissaert
- Re: compare 2 recordsets
- From: Bob Barrows [MVP]
- compare 2 recordsets
- Prev by Date: Re: compare 2 recordsets
- Next by Date: Re: compare 2 recordsets
- Previous by thread: Re: compare 2 recordsets
- Next by thread: Re: compare 2 recordsets
- Index(es):
Relevant Pages
|
|