comparing two recordsets?

Discussion in 'ASP General' started by danielle.m.manning@gmail.com, Mar 22, 2007.

  1. Guest

    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.
     
    , Mar 22, 2007
    #1
    1. Advertising

  2. 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.
     
    Bob Barrows [MVP], Mar 22, 2007
    #2
    1. Advertising

  3. 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.
     
    Bob Barrows [MVP], Mar 22, 2007
    #3
  4. Guest

    On Mar 22, 9:54 am, "Bob Barrows [MVP]" <>
    wrote:
    > 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.
     
    , Mar 22, 2007
    #4
  5. wrote:
    > On Mar 22, 9:54 am, "Bob Barrows [MVP]" <>
    > wrote:
    >> 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.
     
    Bob Barrows [MVP], Mar 22, 2007
    #5
  6. Guest

    On Mar 22, 10:43 am, "Bob Barrows [MVP]" <>
    wrote:
    > wrote:
    > > On Mar 22, 9:54 am, "Bob Barrows [MVP]" <>
    > > wrote:
    > >> 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.
     
    , Mar 22, 2007
    #6
  7. Mike Brind Guest

    <> wrote in message
    news:...
    > On Mar 22, 10:43 am, "Bob Barrows [MVP]" <>
    > wrote:
    >> wrote:
    >> > On Mar 22, 9:54 am, "Bob Barrows [MVP]" <>
    >> > wrote:
    >> >> 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
     
    Mike Brind, Mar 22, 2007
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. AFN
    Replies:
    5
    Views:
    424
    dilipdotnet at apdiya.com
    Feb 11, 2004
  2. Sky
    Replies:
    2
    Views:
    381
  3. Working with recordsets

    , Jan 7, 2005, in forum: Python
    Replies:
    2
    Views:
    294
    Steve Holden
    Jan 8, 2005
  4. Guy Cohen

    ADO+RECORDSETS

    Guy Cohen, Jan 18, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    384
    sloan
    Jan 19, 2007
  5. Replies:
    21
    Views:
    477
    Daniel Crichton
    Jan 19, 2009
Loading...

Share This Page