Compare Dynamic Field to db Entry

Discussion in 'ASP General' started by Simon Gare, Oct 22, 2005.

  1. Simon Gare

    Simon Gare Guest

    Hi

    I need to compare a dynamic field in an asp page to a field in another
    table, if there is no match then i would like to chane the row colour ( see
    code below).

    The problem Im having is that the comparison should be one of many entries
    in that db field, at the moment it only compares the first field in the db.

    Please Help

    <tr
    <%
    Record = Recordset1.Fields.Item("COLL_CITY_TOWN").Value
    Record2 = Recordset2.Fields.Item("TOWN").Value
    If Record = Record2 Then
    strbgcolor="#FFCC66"
    Else
    strbgcolor="silver"
    End If
    %>
    bgcolor="<%=strbgcolor%>">

    Regards
    Simon
     
    Simon Gare, Oct 22, 2005
    #1
    1. Advertising

  2. This question is about asp and databases. Why crosspost to so many unrelated
    groups? The most (and arguably, the only) relevant group is .asp.db. I'm
    setting the followup-to to .asp.db.

    Best practice is to pick one newsgroup to which to post. If you've chosen
    the wrong one, usually someone will let you know. Irritating people* by
    posting off-topic questions is not a good way to maximize your chances of
    getting a reply.


    * I'm not one of the irritated people: I'm trying to help you get your
    answer to this and to future questions as quickly as possible.

    See my response inline:
    Simon Gare wrote:
    > Hi
    >
    > I need to compare a dynamic field in an asp page to a field in
    > another table, if there is no match then i would like to chane the
    > row colour ( see code below).
    >
    > The problem Im having is that the comparison should be one of many
    > entries in that db field, at the moment it only compares the first
    > field in the db.
    >

    I don't understand your question. For one thing, you said you needed to
    compare a "dynamic field in an asp page" to a "field in another table". In
    your code, you compare a field from one recordset to a field in another
    recordset.

    Please clarify what you mean by "many entries", keeping in mind that
    recordsets contain fields and records. Show us some of the data from each
    recordset and show us what you want the result to be. I suspect you want to
    perform a loop, but I'm really not clear what you want to do in that loop.

    Bob b

    > <tr
    > <%
    > Record = Recordset1.Fields.Item("COLL_CITY_TOWN").Value
    > Record2 = Recordset2.Fields.Item("TOWN").Value
    > If Record = Record2 Then
    > strbgcolor="#FFCC66"
    > Else
    > strbgcolor="silver"
    > End If
    > %>
    > bgcolor="<%=strbgcolor%>">
    >


    --
    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"
     
    Bob Barrows [MVP], Oct 22, 2005
    #2
    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. AtomicBob
    Replies:
    14
    Views:
    901
    Toby Inkster
    May 2, 2006
  2. Mike Owen

    Allowing entry of a Carriage Return during data entry

    Mike Owen, Jul 27, 2006, in forum: ASP .Net Web Controls
    Replies:
    3
    Views:
    717
    Alessandro Zifiglio
    Jul 27, 2006
  3. Noozer
    Replies:
    2
    Views:
    262
    Dr John Stockton
    Aug 1, 2005
  4. Anatoli Hristov

    Compare list entry from csv files

    Anatoli Hristov, Nov 26, 2012, in forum: Python
    Replies:
    0
    Views:
    236
    Anatoli Hristov
    Nov 26, 2012
  5. Dave Angel

    Re: Compare list entry from csv files

    Dave Angel, Nov 26, 2012, in forum: Python
    Replies:
    0
    Views:
    252
    Dave Angel
    Nov 26, 2012
Loading...

Share This Page