comparing two recordsets?
comparing two recordsets?
am 22.03.2007 14:13:24 von danielle.m.manning
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.
Re: comparing two recordsets?
am 22.03.2007 14:53:24 von reb01501
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.
Re: comparing two recordsets?
am 22.03.2007 14:54:15 von reb01501
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.
Re: comparing two recordsets?
am 22.03.2007 15:10:13 von danielle.m.manning
On Mar 22, 9:54 am, "Bob Barrows [MVP]"
wrote:
> danielle.m.mann...@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.- 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.
Re: comparing two recordsets?
am 22.03.2007 15:43:10 von reb01501
danielle.m.manning@gmail.com wrote:
> On Mar 22, 9:54 am, "Bob Barrows [MVP]"
> wrote:
>> danielle.m.mann...@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?
>>
>
> 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.
Re: comparing two recordsets?
am 22.03.2007 15:54:03 von danielle.m.manning
On Mar 22, 10:43 am, "Bob Barrows [MVP]"
wrote:
> danielle.m.mann...@gmail.com wrote:
> > On Mar 22, 9:54 am, "Bob Barrows [MVP]"
> > wrote:
> >> danielle.m.mann...@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?
>
> > 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.- 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.
Re: comparing two recordsets?
am 22.03.2007 16:19:45 von Jon Paal
hard to do this with ASP. I suggest posting in an SQL server forum. I think you'll find solutions for this type of problem using
some sort of stored procedure...
microsoft.public.sqlserver.programming
wrote in message news:1174569204.897290.184260@y66g2000hsf.googlegroups.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.
>
Re: comparing two recordsets?
am 22.03.2007 21:34:32 von Mike Brind
wrote in message
news:1174575243.857672.205960@p15g2000hsd.googlegroups.com.. .
> On Mar 22, 10:43 am, "Bob Barrows [MVP]"
> wrote:
>> danielle.m.mann...@gmail.com wrote:
>> > On Mar 22, 9:54 am, "Bob Barrows [MVP]"
>> > wrote:
>> >> danielle.m.mann...@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?
>>
>> > 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.- 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.
>
http://www.w3schools.com/vbscript/vbscript_looping.asp
--
Mike Brind