473,326 Members | 2,104 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Compare Dynamic Field to db Entry

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
Oct 22 '05 #1
1 1949
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"
Oct 22 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Kivak | last post by:
Hey, I have two tables of data, table1 and table2. In Table1, there is a "id" field, a "name" field, and an e-mail field. In table2, there is an "id" field, and paramters that belong to the...
2
by: Ian Vincent | last post by:
I am hoping someone may be able to help. I am using Python and TKinter to create a GUI program that will eventually create an XML file for a project I am working on. Now, the XML file contents...
5
by: Megan | last post by:
Hi everybody- I'm helping a friend with a music database. She has an old one and is creating a new one. She wants to compare records and fields in the old database with records and fields in the...
3
by: Bob Alston | last post by:
I am using a combo box to select the key to records and then go to the selected record on my form. Works well. However, the list, which contains people names, is rather long. What I would like...
1
by: Nathan Sokalski | last post by:
When testing a form of mine which uses RequiredFieldValidators that have the Display property set to "Dynamic" the ErrorMessage property is automatically removed when an entry is completely typed...
5
by: rcolby | last post by:
Evening, Wondering if someone can point me in the right direction, on how I would compare a system.guid with a system.byte. system.guid (pulled from sql server table with a data type of...
7
by: Mike Livenspargar | last post by:
We have an application converted from v1.1 Framework to v2.0. The executable references a class library which in turn has a web reference. The web reference 'URL Behavior' is set to dynamic. We...
17
by: Mark A | last post by:
DB2 8.2 for Linux, FP 10 (also performs the same on DB2 8.2 for Windoes, FP 11). Using the SAMPLE database, tables EMP and EMLOYEE. In the followng stored procedure, 2 NULL columns (COMM) are...
3
by: super.raddish | last post by:
Greetings, I am relatively new to, what I would call, advanced XSLT/XPath and I am after some advice from those in the know. I am attempting to figure out a mechanism within XSLT to compare the...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.