...

View Full Version : Operator signs don't work?!?!?!



dr_luxure
12-17-2004, 12:31 PM
peace up everybody

my code is not working for the ">" and "<" operators but it works for the "="!!!
can somebody help me plz
here is the code




if (request.form("amount")<>"") and (CDbl(Request.Form("cond")="1")) then
record.open "select * from balance where CDbl(netbalance) >'"&CDbl(Request.Form("amount"))&"'",db,1,3


else


if (request.form("amount")<>"") and (CDbl(Request.Form("cond")="-1")) then
record.open "select * from balance where CDbl(netbalance) <'"&CDbl(Request.Form("amount"))&"'",db,1,3


else


if (request.form("amount")<>"") and (CDbl(Request.Form("cond")="0")) then
record.open "select * from balance where CDbl(netbalance) ='"&CDbl(Request.Form("amount"))&"'",db,1,3





the "cond" is a radio buttons
the value "1" for ">" and "-1" for the "<" and "0" for the "="
the "amount " for the textbox to know what to select comparing with what

balance is the table name
netbalance is the column to be selected

thanx alot

glenngv
12-17-2004, 12:48 PM
Try this:


dim amt, cond, sql
amt = request.form("amount")
cond = request.form("cond")
if (amt<>"") then
if (cond="1") then
sql = "select * from balance where netbalance > " & amt
elseif (cond="-1") then
sql = "select * from balance where netbalance < " & amt
else 'cond=0
sql = "select * from balance where netbalance = " & amt
end if

'debug
response.write "sql:" & sql

record.open sql, db, 1, 3
'...
end if

dr_luxure
12-18-2004, 08:00 AM
Thank u very much

i appreciate it

but i actually use the microsoft access as a DB

will that code work??



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum