A
Aaron [SQL Server MVP]
You might try comparing apples to apples, e.g. if clng(something) =
clng(something_else) then
--
http://www.aspfaq.com/
(Reverse address to reply.)
clng(something_else) then
--
http://www.aspfaq.com/
(Reverse address to reply.)
Chris Tilley - HPC:Factor said:Hi,
I'm utterly confounded by this one. There must be some sort of rule that
I don't know of. I'd consider myself a Newbie+1, so be gentle.
I have a database connection (working A-Ok) and a Query String value from a
form (passed using GET & working Ok). The server is IIS5.
What I'm trying to do is get a simple IF statement to work accross the two
numeric values. Once from a database and one from a Query String.
If %Database value% = %query string value% then
response.write("something")
else
response.write("nothing")
end if
...but it's not working. It always without fail responds with "nothing".
If I response.write the database variable and the query strings the values
are all numeric and there is always going to be a match. There are only 3
records in the database and 3 options on the form.
If I change it to %Database value%=%Database value% then it works,
specifying "something" on all the results. If I manually place a numeric
value into the code in place of %Query string value% it works as it should
do, except that of course it's static.
Here is the entire code segment:
<%
checkmcat=Request.Querystring("mstrcat")
SQLREVMCAT="SELECT TBL_revmcat.revmcat_ID, TBL_revmcat.revmcat_Name FROM
TBL_revmcat ORDER BY TBL_revmcat.revmcat_Name"
set revmcat = server.createobject("ADODB.Connection")
revmcat.open = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
Server.MapPath("/database.mdb")
set REV_mcat=revmcat.execute(SQLREVMCAT)
%>
<% do while not REV_mcat.eof %>
<option<% if REV_mcat(0) = checkmcat then
response.write(" SELECTED")
else
response.write("")
end if %> value="<%= REV_mcat(0) %>">- <%= REV_mcat(1)
%> said:<%REV_mcat.movenext
loop%>
<% revmcat.close %>
</select>
revmcat_ID [ REV_mcat(0) ] is a long integer AutoNumber in the Access 2000
database & is the tables Primary Key.
I've come across this before on another project I was fiddling with, in the
end I just completly change the entire database / code to work around the
problem. I can't see away round it this time though.
I guess that it is probably something obvious, or a rule I don't know of.
I've just been staring at it for so long, I'm suffering code blindness.
Thanks.
Chris