Comparing fields

Discussion in 'ASP General' started by bvlmv@hotmail.com, Oct 24, 2006.

  1. Guest

    Greetings,
    I have a simple html/asp form that submits data to an access DB. The
    idea is
    when calling a record back from the db, the page will have an option to

    change certain fields (drop down) then a new submit option.
    My question at this point would be what logic or commands would I use
    to compare the original data in the fields to what's being submitted. I

    ultimately want to preserve the original records and somehow append
    data that changes only. I'll need to eventually call a record and see
    all the changes/updates made.
    Someone mentioned I would prob need a couple of tables with a link
    (relationship) but is it possible to dynamically create fields as
    changes are made?

    Thanks in advance,
    , Oct 24, 2006
    #1
    1. Advertising

  2. Hi,

    Just wanna make sure i got the question before i write you the code.
    Do you want to compare the old record with the new one by each letter
    or character in the field
    for example:
    Field1(OLD): Hello
    Text to add to Field1: Heeey

    the result: last three characters are diffrent

    is this what you are looking for??


    Best Regards
    Firas S Assaad
    On Oct 24, 7:47 am, wrote:
    > Greetings,
    > I have a simple html/asp form that submits data to an access DB. The
    > idea is
    > when calling a record back from the db, the page will have an option to
    >
    > change certain fields (drop down) then a new submit option.
    > My question at this point would be what logic or commands would I use
    > to compare the original data in the fields to what's being submitted. I
    >
    > ultimately want to preserve the original records and somehow append
    > data that changes only. I'll need to eventually call a record and see
    > all the changes/updates made.
    > Someone mentioned I would prob need a couple of tables with a link
    > (relationship) but is it possible to dynamically create fields as
    > changes are made?
    >
    > Thanks in advance,
    Firas S Assaad, Oct 24, 2006
    #2
    1. Advertising

  3. Guest

    Hi,
    It would search the current field and check for an exact match (letter
    by letter with no case sensative). If it finds a match then it won't
    write anything to the DB otherwise it will write the new information in
    the DB.

    Thanks,

    Firas S Assaad wrote:
    > Hi,
    >
    > Just wanna make sure i got the question before i write you the code.
    > Do you want to compare the old record with the new one by each letter
    > or character in the field
    > for example:
    > Field1(OLD): Hello
    > Text to add to Field1: Heeey
    >
    > the result: last three characters are diffrent
    >
    > is this what you are looking for??
    >
    >
    > Best Regards
    > Firas S Assaad
    > On Oct 24, 7:47 am, wrote:
    > > Greetings,
    > > I have a simple html/asp form that submits data to an access DB. The
    > > idea is
    > > when calling a record back from the db, the page will have an option to
    > >
    > > change certain fields (drop down) then a new submit option.
    > > My question at this point would be what logic or commands would I use
    > > to compare the original data in the fields to what's being submitted. I
    > >
    > > ultimately want to preserve the original records and somehow append
    > > data that changes only. I'll need to eventually call a record and see
    > > all the changes/updates made.
    > > Someone mentioned I would prob need a couple of tables with a link
    > > (relationship) but is it possible to dynamically create fields as
    > > changes are made?
    > >
    > > Thanks in advance,
    , Oct 25, 2006
    #3
  4. <> wrote in message
    news:...
    > Greetings,
    > I have a simple html/asp form that submits data to an access DB. The
    > idea is
    > when calling a record back from the db, the page will have an option to
    >
    > change certain fields (drop down) then a new submit option.
    > My question at this point would be what logic or commands would I use
    > to compare the original data in the fields to what's being submitted. I
    >
    > ultimately want to preserve the original records and somehow append
    > data that changes only. I'll need to eventually call a record and see
    > all the changes/updates made.
    > Someone mentioned I would prob need a couple of tables with a link
    > (relationship) but is it possible to dynamically create fields as
    > changes are made?
    >


    No. How many fields would be changing in a single post?

    Here are two choices:-

    1).

    Have a second table which is identical to the first except it has version
    number field added to the primary key include a version number on the
    original table but do not add it to the primary key. After an update
    happens on the table (the version number is incremented as part of the
    update) make an insert to second table verbatim from the row that was just
    updated. It's simple and effective but can make the DB large due to some
    duplication of field values that have not changed, which in Access may be a
    concern.

    2).

    Another choice is to have second table which includes the same fields that
    make up the PK of the original table and adds a version number to them which
    is also included in the original table. This table has a FieldName column
    to contain the name of a field that is changing. It also has a value column
    which contains a string that represents the value of the field for the
    version.

    When an update occurs allocate the next version number for the record to be
    updates. Then compare the string version value of the each field being
    updated with the incoming changes, if different insert a new record to the
    second table with the PK of the record being updated, the new version
    number, the field name and the new string value. After all the changes have
    been logged make the update itself.

    This approach suffers from complexity and results in values being stored as
    strings rather than their native types. Also the more fields that change
    per update the more duplication of PK and version number there will be.
    That combined with using a string to represent data which is often smaller
    in it's native type may mean this approach will also bloat your DB.


    If you do use any of these approaches use a transaction to make the updates
    atomic.
    I prefer (and have used albeit in SQL Server) approach 1.


    > Thanks in advance,
    >
    Anthony Jones, Oct 26, 2006
    #4
    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. call_me_anything
    Replies:
    4
    Views:
    454
    Pete Becker
    Sep 30, 2007
  2. bateman5
    Replies:
    10
    Views:
    261
    Brian Genisio
    Feb 17, 2004
  3. M.i.r.a.g.e.

    Comparing two 12hr time fields

    M.i.r.a.g.e., Aug 30, 2004, in forum: Javascript
    Replies:
    4
    Views:
    111
    M.i.r.a.g.e.
    Sep 2, 2004
  4. Replies:
    3
    Views:
    121
    John W. Krahn
    Nov 28, 2007
  5. The guy upstairs

    comparing two email fields

    The guy upstairs, Nov 19, 2006, in forum: Javascript
    Replies:
    2
    Views:
    102
    mick white
    Nov 19, 2006
Loading...

Share This Page