Compare db entry with dynamic text on asp page

Compare db entry with dynamic text on asp page

am 24.10.2005 07:20:00 von Simon Gare

Sorry I not making it clear,

If the dynamic filed on the asp page from recordset 1 was, for example,
London I neeed the code below to match 'London' to a list of entries in
Recordset 2 and return a row background colour based on the match. Recordset
2 is another table with a list of towns only.

<%
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

"Ray Costanzo [MVP]" wrote in
message news:%23joven11FHA.3560@TK2MSFTNGP15.phx.gbl...
>
> Are you saying that you want to compare the entire record to the other
> record? What do you mean by "one of many entries in that db field?" Your
> current comparison should yield you a boolean result. What comparison did
> you want to do?
>
> Ray at home
>
>
> "Simon Gare" wrote in message
> news:e9TTRSz1FHA.3524@tk2msftngp13.phx.gbl...
> > 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
> >
> > > > <%
> > 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
> >
> >
>
>

Re: Compare db entry with dynamic text on asp page

am 24.10.2005 12:48:57 von reb01501

Sorry, but it is bad form to start a new topic about a previously posted
question, especially when you do not provide any additional information. We
now have two conversations going on about the same topic which can get very
confusing. People will avoid replying because they will run the risk of
wasting time responding in one thread when the problem has already been
resolved in the other thread. This is not a good way to maximize your
chances of getting help.

See below for more:

Simon Gare wrote:
> Sorry I not making it clear,
>
> If the dynamic filed on the asp page from recordset 1 was, for
> example, London I neeed the code below to match 'London' to a list of
> entries in Recordset 2 and return a row background colour based on
> the match. Recordset 2 is another table with a list of towns only.
>
> > <%
> 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%>">
>

All you did was restate you original question. It did not help. Your problem
is as bague as ever.

The best way to explain your problem is to show us a sample set of the data
(several records) from each recordset and explain what the resulting display
needs to look like.

Please start by explaining how a recordset can contain the entry a user made
in a dynamic field in an asp page. Recordsets typically contain data from a
database, not entries into html fields.

Bob Barrows
--
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"

Re: Compare db entry with dynamic text on asp page

am 25.10.2005 22:47:21 von SteveB

strSQL = "SELECT BackgroundColor FROM tblTownAndBackgroundColor WHERE
Town = " & Chr(39) & objRS1("Town") & Chr(39)

Or

strSQL = "SELECT BackgroundColor FROM tblTownAndBackgroundColor WHERE
Town = " & Chr(39) & Request.Form("Town") & Chr(39)

Best regards,
J. Paul Schmidt, Freelance Web and Database Developer
http://www.Bullschmidt.com
Access Database Sample, Web Database Sample, ASP Design Tips

<<
If the dynamic filed on the asp page from recordset 1 was, for example,
London I neeed the code below to match 'London' to a list of entries in
Recordset 2 and return a row background colour based on the match.
Recordset
2 is another table with a list of towns only.
>>

*** Sent via Developersdex http://www.developersdex.com ***

Re: Compare db entry with dynamic text on asp page

am 25.10.2005 22:47:26 von SteveB

And perhaps this may hopefully give you some ideas. It's got a
downloadable sample and does retain values after the post back (although
it is admittedly somewhat complicated):

Classic ASP Design Tips - Dependent Listboxes
http://www.bullschmidt.com/devtip-dependentlistboxes.asp

Best regards,
J. Paul Schmidt, Freelance Web and Database Developer
http://www.Bullschmidt.com
Access Database Sample, Web Database Sample, ASP Design Tips

*** Sent via Developersdex http://www.developersdex.com ***

Re: Compare db entry with dynamic text on asp page

am 27.10.2005 23:40:39 von Simon Gare

Thanks for this but i'm new to SQL where and how would you place the code ?

Thanks in advance
Simon


"Bullschmidt" wrote in message
news:e7WtMVa2FHA.3596@TK2MSFTNGP12.phx.gbl...
> strSQL = "SELECT BackgroundColor FROM tblTownAndBackgroundColor WHERE
> Town = " & Chr(39) & objRS1("Town") & Chr(39)
>
> Or
>
> strSQL = "SELECT BackgroundColor FROM tblTownAndBackgroundColor WHERE
> Town = " & Chr(39) & Request.Form("Town") & Chr(39)
>
> Best regards,
> J. Paul Schmidt, Freelance Web and Database Developer
> http://www.Bullschmidt.com
> Access Database Sample, Web Database Sample, ASP Design Tips
>
> <<
> If the dynamic filed on the asp page from recordset 1 was, for example,
> London I neeed the code below to match 'London' to a list of entries in
> Recordset 2 and return a row background colour based on the match.
> Recordset
> 2 is another table with a list of towns only.
> >>
>
> *** Sent via Developersdex http://www.developersdex.com ***