473,383 Members | 1,840 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,383 software developers and data experts.

howto fixthis if statement

I write a code to change variable by this if statement but it not work alwaysgive the else

Expand|Select|Wrap|Line Numbers
  1. if request("txtSearch2") = "" then
  2.  
  3.  
  4.                     'select case sens
  5.                     if request("Sense")= "on" then   
  6.                     sqlPRJ = "SELECT TCKT_ID,TCKT_OPN_DATE,TCKT_DESC FROM TCKTs WHERE TCKT_DESC like '%'+'"&request("txtSearch1")&"'+'%'COLLATE SQL_Latin1_General_CP1_CS_AS"                    
  7.                      else
  8.                     sqlPRJ = "SELECT TCKT_ID,TCKT_OPN_DATE,TCKT_DESC FROM TCKTs WHERE TCKT_DESC like '%'+'"&request("txtSearch1")&"'+'%'"
  9.                     end if
  10.                 end if
Dec 23 '08 #1
3 1575
CroCrew
564 Expert 512MB
Hello AliHabib,

Try adding some debugging code like the one below to see what your getting for your values and where you fall into your ‘If Then’ statements.

Expand|Select|Wrap|Line Numbers
  1. response.write("This is the value for 'txtSearch2': [" & request("txtSearch2") & "]</br>")
  2. if request("txtSearch2") = "" then 
  3.     response.write("This is the value for 'Sense': [" & request("Sense") & "]</br>")
  4.  
  5.     if request("Sense")= "on" then    
  6.         response.write("True")
  7.     else 
  8.         response.write("False")
  9.     end if 
  10. end if 
  11.  
Hope this helps,
CroCrew~
Dec 23 '08 #2
jhardman
3,406 Expert 2GB
try trimming your request (removes spaces)
Expand|Select|Wrap|Line Numbers
  1. if trim(request("txtSearch2")) = "" then                        
let me know if this helps.

Jared
Dec 24 '08 #3
Nicodemas
164 Expert 100+
@AliHabib

Remember that the conditional is going to compare this EXACT test. If the value of request("Sense") is being passed along as "on" (note, no leading/trailing spaces, all lowercase) then it should work.

Try this and see:


Expand|Select|Wrap|Line Numbers
  1. if trim(request("txtSearch2")) = "" then 
  2.    'select case sens 
  3.    if lcase(trim(request("Sense")))= "on" then    
  4.       sqlPRJ = "SELECT TCKT_ID,TCKT_OPN_DATE,TCKT_DESC FROM TCKTs WHERE TCKT_DESC like '%'+'"&request("txtSearch1")&"'+'%'COLLATE SQL_Latin1_General_CP1_CS_AS"                     
  5.    else 
  6.       sqlPRJ = "SELECT TCKT_ID,TCKT_OPN_DATE,TCKT_DESC FROM TCKTs WHERE TCKT_DESC like '%'+'"&request("txtSearch1")&"'+'%'" 
  7.    end if 
  8. end if
  9.  
If that does not work, your Request parameter is not correct or you are sending the wrong string in request("Sense").
Dec 25 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Josef Sachs | last post by:
Is Andrew Kuchling's regex-to-re HOWTO available anywhere? I've found the following (dead) links on various Web pages: http://py-howto.sourceforge.net/regex-to-re/regex-to-re.html...
3
by: Clausmeyer | last post by:
I want to execute a dynamically generated sql-statement from inside an user-defined-function. Calling functions and extended stored-procs is allowed so I tried sp_executesql as well as...
3
by: googlemike | last post by:
You may have a requirement that you cannot change where you have old apps, such as Delphi 3 apps (in my case), that must hobble along until the BIG migration money comes into migrate to something...
1
by: Serdge Kooleman | last post by:
hi i have Access 2000 database. All id is guid, so it is always unique. several users add data into own copy of this database. then they send .mdb files to me (by e-mail). how to copy the...
4
by: Ray Dukes | last post by:
What I am looking to do is map the implementation of interface properties and functions to an inherited method of the base class. Please see below. ...
6
by: Ian Boyd | last post by:
Every time during development we had to make table changes, we use Control Center. Most of the time, Control Center fails. If you try to "undo all", it doesn't, and you end up losing your identity...
5
by: Stef Mientki | last post by:
How should I overload / disable a method ? In the example below I have defined the class "Power_Supply", derived from baseclass "device". The baseclass has a method "execute", which will be...
7
by: =?Utf-8?B?QVRT?= | last post by:
HOWTO Run multiple SQL statements from ASP/ADO to an Oracle 10g. Please help, I'm trying to write an ASP page to use ADO to run a long query against an Oracle 10g database, to create tables,...
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...
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.