Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Dec 2004
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up Operator signs don't work?!?!?!

    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

    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
    Last edited by dr_luxure; 12-17-2004 at 12:39 PM.

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,068
    Thanks
    0
    Thanked 256 Times in 252 Posts
    Try this:
    Code:
    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
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #3
    New to the CF scene
    Join Date
    Dec 2004
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question thanx , but ......

    Thank u very much

    i appreciate it

    but i actually use the microsoft access as a DB

    will that code work??


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •