Defining a Number v Text

Hello all and thanks in advance for your assistance

I am having issues with what I thought was how to tell the difference between a number and text by using IsNumeric, however I am finding that for example
If IsNumeric(Request.QueryString("all") Then

Open in new window

is processing and giving an output...

Is there something I am missing?
Graemewebber4technologiesAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Manuel Marienne-DuchêneITMCommented:
If IsNumeric(Request.QueryString("all") ) Then

Open in new window


Miss )
0
Graemewebber4technologiesAuthor Commented:
Sorry Manuel, yes I did miss it in this Question... however it is in the code.. sorry again
0
Manuel Marienne-DuchêneITMCommented:
The IsNumeric function returns a Boolean value that indicates whether a specified expression can be evaluated as a number. It returns True if the expression is recognized as a number; otherwise, it returns False.

<%

Dim x
x=10
response.write(IsNumeric(x) & "<br />")
x=Empty
response.write(IsNumeric(x) & "<br />")
x=Null
response.write(IsNumeric(x) & "<br />")
x="10"
response.write(IsNumeric(x) & "<br />")
x="911 Help"
response.write(IsNumeric(x))

%>
The output of the code above will be:

True
True
False
True
False
0
OWASP Proactive Controls

Learn the most important control and control categories that every architect and developer should include in their projects.

Graemewebber4technologiesAuthor Commented:
Thanks for that Manuel

The issue im getting is...

x="all"
response.write(IsNumeric(x))

If IsNumeric(x) Then

This is coming true and then proceeding in the IF statement
0
Graemewebber4technologiesAuthor Commented:
The actual Code that is having an issue is:

Request.QueryString("event")="all"

If IsNumeric(Request.QueryString("event")) Then

Open in new window

0
Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
x="all"
response.write(IsNumeric(x))
this returned as false to me.
0
Graemewebber4technologiesAuthor Commented:
Hi Ryan, in post 42071145, I am displaying the code that is having an issue... :(

I have just thought of something... Its showing up on a page that doesnt require is... eg http://dev.gptouring.com.au/?
0
Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
Request.QueryString("event")="all"
this should be an invalid statement and your page would have generated an error on screen.
0
Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
Microsoft JET Database Engine error '80040e14'

Syntax error (missing operator) in query expression 'event_code=code_short AND event_start>Now() AND code_live=TRUE AND event_live=TRUE AND event_ID='. 

Open in new window


as what i guess... from this error, it mentioned that Request.QueryString("event") is missing which causing error in your SQL statement.

so you need to have a better error handling in case Request.QueryString("event") is not found.
0
Graemewebber4technologiesAuthor Commented:
I think I have figured it out...

If IsNumeric(Request.QueryString("event")) AND NOT (Request.QueryString="" OR Request.QueryString="?") Then

Open in new window


doesnt error... is that because it would see "" OR "?" as IsNumeric?
0
Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
If IsNumeric(Request.QueryString("event")) AND NOT (Request.QueryString="" OR Request.QueryString="?") Then
nope... what if you have this?

http://dev.gptouring.com.au/?x
http://dev.gptouring.com.au/?bla=

Open in new window

etc?
0
Graemewebber4technologiesAuthor Commented:
I am getting errors on:
http://dev.gptouring.com.au/?category=70
Microsoft JET Database Engine error '80040e14'

Syntax error (missing operator) in query expression 'event_code=code_short AND event_start>Now() AND code_live=TRUE AND event_live=TRUE AND event_ID='.

Open in new window


Why would this happen?

Im not even asking for Request.QueryString("event") on this page...
0
Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
Im not even asking for Request.QueryString("event") on this page... 

Open in new window

try post and examine the codes around:

AND event_ID=

Open in new window


and you should fine that something is missing there
0
Graemewebber4technologiesAuthor Commented:
I am now using:
If IsNumeric(Request.QueryString("event")) AND Len(Request.QueryString("event"))>0 AND NOT (Request.QueryString="" OR Request.QueryString="?") Then

Open in new window


Surely it shouldnt be that hard? should it?

for:
AND event_ID=

Open in new window

This isnt even on the IF statement page that it is writing, its complete different section...
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
i would simply use:

If IsNumeric(Request.QueryString("event")) Then

Open in new window


to ensure a numeric event (ID) was provided

This isnt even on the IF statement page that it is writing, its complete different section...
I think somehow in your codes logic, it hits that line of code and run it, which causing the error and display on your page.
0
Graemewebber4technologiesAuthor Commented:
Yeah I a not sure why...

The homepage of the website is first in the hierarchy order and the Query that it is erroring on (the line we have seen
'event=') is after it.

just strange!

seems to be not erroring now, been through alot of pages and all good
0
Graemewebber4technologiesAuthor Commented:
Strange that it is doing this, but work around works
0
Graemewebber4technologiesAuthor Commented:
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.