comparing two recordsets?
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > IIS server support > IIS ASP > comparing two recordsets?




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    comparing two recordsets?  
danielle.m.manning@gmail.com


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
03-22-07 06:26 PM

Can someone help me figure out what is the best way to perform this
task?

I have to detect if there were any changes from one recordset to
another.  My recordset consists of a key (guid), and then three
fields.  There will probably only be three or four records in each
set, so i'm not going to be dealing with a ton of processing.

For Example:
oRS - recordsetname
oRS("EmpKey") - my guid for the record
oRS("Name") - name of the employee
oRS("Salary") - salary of the employee
oRS("Hours")  - hours the employee worked this week

In a language like perl, i would create two hashes, and compare these
hashes by key - but i don't know how to do this in ASP.   I only need
to know if they differ in some way - but I don't think just doing a
rowcount is going to suffice.

Thanks for any assistance.






[ Post a follow-up to this message ]



    Re: comparing two recordsets?  
Bob Barrows [MVP]


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
03-22-07 06:26 PM

danielle.m.manning@gmail.com wrote:
> Can someone help me figure out what is the best way to perform this
> task?
>
> I have to detect if there were any changes from one recordset to
> another.  My recordset consists of a key (guid), and then three
> fields.  There will probably only be three or four records in each
> set, so i'm not going to be dealing with a ton of processing.
>
> For Example:
> oRS - recordsetname
> oRS("EmpKey") - my guid for the record
> oRS("Name") - name of the employee
> oRS("Salary") - salary of the employee
> oRS("Hours")  - hours the employee worked this week
>
> In a language like perl, i would create two hashes, and compare these
> hashes by key - but i don't know how to do this in ASP.   I only need
> to know if they differ in some way - but I don't think just doing a
> rowcount is going to suffice.
>
Could you provide more details? it could be you are trying to duplicate
functionality that already exists. Is the data in the recordsets from
the same server/database/table?

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.







[ Post a follow-up to this message ]



    Re: comparing two recordsets?  
Bob Barrows [MVP]


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
03-22-07 06:26 PM

danielle.m.manning@gmail.com wrote:
> Can someone help me figure out what is the best way to perform this
> task?
>
> I have to detect if there were any changes from one recordset to
> another.  My recordset consists of a key (guid), and then three
> fields.  There will probably only be three or four records in each
> set, so i'm not going to be dealing with a ton of processing.
>
> For Example:
> oRS - recordsetname
> oRS("EmpKey") - my guid for the record
> oRS("Name") - name of the employee
> oRS("Salary") - salary of the employee
> oRS("Hours")  - hours the employee worked this week
>
> In a language like perl, i would create two hashes, and compare these
> hashes by key - but i don't know how to do this in ASP.   I only need
> to know if they differ in some way - but I don't think just doing a
> rowcount is going to suffice.
>
Oh! And what types of changes are you trying to detect? Added/Deleted
records? Modified data in any of the fields?

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.







[ Post a follow-up to this message ]



    Re: comparing two recordsets?  
danielle.m.manning@gmail.com


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
03-22-07 06:26 PM

On Mar 22, 9:54 am, "Bob Barrows [MVP]" <reb01...@NOyahoo.SPAMcom>
wrote:
> danielle.m.mann...@gmail.com wrote: 
> 
> 
> 
>
> Oh! And what types of changes are you trying to detect? Added/Deleted
> records? Modified data in any of the fields?
>
> --
> Microsoft MVP -- ASP/ASP.NET
> Please reply to the newsgroup. The email account listed in my From
> header is my spam trap, so I don't check it very often. You will get a
> quicker response by posting to the newsgroup.- Hide quoted text -
>
> - Show quoted text -

Thanks for your assistance -

I am trying to detect any changes - an addition, a deletion, or a
modification in the fields.  As far as the data being in the database
- it's not.  The functionality as it exists is that for a given key, a
"kill and fill" is done with the records in the database.  What I have
done is before the "kill" - put the existing records in a recordset.
Then the kill and fill is performed.  But I want to compare the
records as they were in the database before the kill with the new
records in the "fill" to see if a "change record" needs to be
written.

I'm trying to not change too much of the existing functionality in
order to accomplish the determination of a change -

Thanks again.






[ Post a follow-up to this message ]



    Re: comparing two recordsets?  
Bob Barrows [MVP]


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
03-22-07 06:26 PM

danielle.m.manning@gmail.com wrote:
> On Mar 22, 9:54 am, "Bob Barrows [MVP]" <reb01...@NOyahoo.SPAMcom>
> wrote: 
>
> Thanks for your assistance -
>
> I am trying to detect any changes - an addition, a deletion, or a
> modification in the fields.  As far as the data being in the database
> - it's not.  The functionality as it exists is that for a given key, a
> "kill and fill" is done with the records in the database.  What I have
> done is before the "kill" - put the existing records in a recordset.
> Then the kill and fill is performed.  But I want to compare the
> records as they were in the database before the kill with the new
> records in the "fill" to see if a "change record" needs to be
> written.

And what if the data in the database changes while you are doing this
comparison?
I really don't like this approach. Too much reliance on cursors and not
enough on transaction processing. What database are you using? If SQL
Server, then you should definitely be using a trigger to generate your
"change record".
>
> I'm trying to not change too much of the existing functionality in
> order to accomplish the determination of a change -
>
> Thanks again.

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.







[ Post a follow-up to this message ]



    Re: comparing two recordsets?  
danielle.m.manning@gmail.com


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
03-22-07 06:26 PM

On Mar 22, 10:43 am, "Bob Barrows [MVP]" <reb01...@NOyahoo.SPAMcom>
wrote:
> danielle.m.mann...@gmail.com wrote: 
> 
> 
> 
> 
> 
> 
>
> And what if the data in the database changes while you are doing this
> comparison?
> I really don't like this approach. Too much reliance on cursors and not
> enough on transaction processing. What database are you using? If SQL
> Server, then you should definitely be using a trigger to generate your
> "change record".
>
>
> 
> 
>
> --
> Microsoft MVP -- ASP/ASP.NET
> Please reply to the newsgroup. The email account listed in my From
> header is my spam trap, so I don't check it very often. You will get a
> quicker response by posting to the newsgroup.- Hide quoted text -
>
> - Show quoted text -

I don't like the approach either - but I am guaranteed that the data
won't change in the database because it is on a per user basis - so,
unless two people are logged in as the same user -there can't be any
changes underneath.

This is SQL Server.  Triggers (for this business) are not desireable
due to their maintainability.

I think i am being too unclear - I am really just looking for syntax
for a looping mechanism.  For example -
if I have

key 1
key 2
key 3

in the first set and
key 1
key 2
key 3

in the second set - how can i compare the datas key / value pairs?

As I mentioned - this is something I would do using a foreach & a hash
in PERL .   I am just not familiar enough with Classic ASPs constructs
to know what is the proper mechanism.






[ Post a follow-up to this message ]



    Re: comparing two recordsets?  
Jon Paal [MSMD]


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
03-22-07 06:26 PM

hard to do this with ASP.  I suggest posting in an SQL server forum.  I thin
k you'll find solutions for this type of problem using
some sort of stored procedure...

microsoft.public.sqlserver.programming




<danielle.m.manning@gmail.com> wrote in message news:1174569204.897290.184260@y66g2000hsf.go
oglegroups.com...
> Can someone help me figure out what is the best way to perform this
> task?
>
> I have to detect if there were any changes from one recordset to
> another.  My recordset consists of a key (guid), and then three
> fields.  There will probably only be three or four records in each
> set, so i'm not going to be dealing with a ton of processing.
>
> For Example:
> oRS - recordsetname
> oRS("EmpKey") - my guid for the record
> oRS("Name") - name of the employee
> oRS("Salary") - salary of the employee
> oRS("Hours")  - hours the employee worked this week
>
> In a language like perl, i would create two hashes, and compare these
> hashes by key - but i don't know how to do this in ASP.   I only need
> to know if they differ in some way - but I don't think just doing a
> rowcount is going to suffice.
>
> Thanks for any assistance.
>







[ Post a follow-up to this message ]



    Re: comparing two recordsets?  
Mike Brind


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
03-23-07 12:23 AM


<danielle.m.manning@gmail.com> wrote in message
news:1174575243.857672.205960@p15g2000hsd.googlegroups.com...
> On Mar 22, 10:43 am, "Bob Barrows [MVP]" <reb01...@NOyahoo.SPAMcom>
> wrote: 
>
> I don't like the approach either - but I am guaranteed that the data
> won't change in the database because it is on a per user basis - so,
> unless two people are logged in as the same user -there can't be any
> changes underneath.
>
> This is SQL Server.  Triggers (for this business) are not desireable
> due to their maintainability.
>
> I think i am being too unclear - I am really just looking for syntax
> for a looping mechanism.  For example -
> if I have
>
> key 1
> key 2
> key 3
>
> in the first set and
> key 1
> key 2
> key 3
>
> in the second set - how can i compare the datas key / value pairs?
>
> As I mentioned - this is something I would do using a foreach & a hash
> in PERL .   I am just not familiar enough with Classic ASPs constructs
> to know what is the proper mechanism.
>

http://www.w3schools.com/vbscript/vbscript_looping.asp

--
Mike Brind







[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 06:59 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register