Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP General (http://www.velocityreviews.com/forums/f65-asp-general.html)
-   -   Why is Request.QuerySting being treated as a number? (http://www.velocityreviews.com/forums/t790770-why-is-request-querysting-being-treated-as-a-number.html)

Jules 10-07-2003 01:57 PM

Why is Request.QuerySting being treated as a number?
 
Hi:

I have the following:

NRYear = Request.QueryString("nryear")

which I assumed would result in NRYear containing a string.

However, when I concatenate it with "1/1/", I get "1/1/+2003" as if
the NRYear is a number.

Ultimately, this will go in a SQL string such as

SQL = "Select * from newsreleases where nrdate between 1/1/2003 and
12/31/2003;"

and I want the year to come from the Request.QueryString as the user's
selection.

Help!!! Running out of ideas,

Jules

Ray at 10-07-2003 02:00 PM

Re: Why is Request.QuerySting being treated as a number?
 
And how are you concatenating? You're apparently also concatenating a "+"
in there. Either that, or the + is in your querystring value.

Ray at work

"Jules" <julian.rickards@ndm.gov.on.ca> wrote in message
news:f53140ee.0310070557.6b4623dc@posting.google.c om...
> Hi:
>
> I have the following:
>
> NRYear = Request.QueryString("nryear")
>
> which I assumed would result in NRYear containing a string.
>
> However, when I concatenate it with "1/1/", I get "1/1/+2003" as if
> the NRYear is a number.
>
> Ultimately, this will go in a SQL string such as
>
> SQL = "Select * from newsreleases where nrdate between 1/1/2003 and
> 12/31/2003;"
>
> and I want the year to come from the Request.QueryString as the user's
> selection.
>
> Help!!! Running out of ideas,
>
> Jules




Aaron Bertrand - MVP 10-07-2003 02:02 PM

Re: Why is Request.QuerySting being treated as a number?
 
> However, when I concatenate it with "1/1/", I get "1/1/+2003" as if
> the NRYear is a number.


Could you possibly show the code you are using to concatenate?



Bob Barrows 10-07-2003 02:03 PM

Re: Why is Request.QuerySting being treated as a number?
 
That does not happen to me.

sYear = "2003"
Response.write "1/1" & sYear

results in the expected "1/1/2003"

Please show us how to reproduce your problem.

Bob Barrows

Jules wrote:
> Hi:
>
> I have the following:
>
> NRYear = Request.QueryString("nryear")
>
> which I assumed would result in NRYear containing a string.
>
> However, when I concatenate it with "1/1/", I get "1/1/+2003" as if
> the NRYear is a number.
>
> Ultimately, this will go in a SQL string such as
>
> SQL = "Select * from newsreleases where nrdate between 1/1/2003 and
> 12/31/2003;"
>
> and I want the year to come from the Request.QueryString as the user's
> selection.
>
> Help!!! Running out of ideas,
>
> Jules




Julian Rickards 10-07-2003 03:16 PM

Re: Why is Request.QuerySting being treated as a number?
 
OK, here is the code:

NRYear = Request.QueryString("nryear")
StartOfYear = "11/1/" & NRYear
EndOfYear = "12/31/" & NRYear
SQLWhereString = "newsreleases.nrdate Between " & StartOfYear & " And "
& EndOfYear

Response.Write SQLWhereString

and the Response.Write spits out (exactly as pasted below):

newsreleases.nrdate Between 11/1/+2003" And 12/31/+2003"


I am building a search form where the user selects the year and I am
trying to build a between clause from the year selected.

Jules

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Julian Rickards 10-07-2003 03:16 PM

Re: Why is Request.QuerySting being treated as a number?
 
HI:

I hope this isn't being double posted - I tried to post a response
directly to DevDex but it hasn't appeared after about 30 minutes of
waiting.

OK, here is the code:

NRYear = Request.QueryString("nryear")
StartOfYear = "1/1/" & NRYear
EndOfYear = "12/31/" & NRYear
SQLWhereString = "newsreleases.nrdate Between " & StartOfYear & " And "
& EndOfYear

Response.Write SQLWhereString


The output from the response.write is (copied and pasted exactly as
output):

newsreleases.nrdate Between 1/1/+2003" And 12/31/+2003"

So, as you can see, there is a plus (+) at the beginning and a double
quote at the end of each NRYear.

Jules

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Ray at 10-07-2003 03:22 PM

Re: Why is Request.QuerySting being treated as a number?
 
Well, your plus is in your querystring then. Your URL must look like this:


yoursite.com/page.asp?nryear=+2003 or yoursite.com/page.asp?nryear=%2B2003

You'll see this if you do:

RESPONSE.WRITE REQUEST.QUERYSTRING("NRYEAR")
RESPONSE.END


Ray at work

"Julian Rickards" <julian.rickards@ndm.gov.on.ca> wrote in message
news:uDjOOYOjDHA.3192@TK2MSFTNGP11.phx.gbl...
> HI:
>
> I hope this isn't being double posted - I tried to post a response
> directly to DevDex but it hasn't appeared after about 30 minutes of
> waiting.
>
> OK, here is the code:
>
> NRYear = Request.QueryString("nryear")
> StartOfYear = "1/1/" & NRYear
> EndOfYear = "12/31/" & NRYear
> SQLWhereString = "newsreleases.nrdate Between " & StartOfYear & " And "
> & EndOfYear
>
> Response.Write SQLWhereString
>
>
> The output from the response.write is (copied and pasted exactly as
> output):
>
> newsreleases.nrdate Between 1/1/+2003" And 12/31/+2003"
>
> So, as you can see, there is a plus (+) at the beginning and a double
> quote at the end of each NRYear.
>
> Jules
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!




Ray at 10-07-2003 03:25 PM

Re: Why is Request.QuerySting being treated as a number?
 
Oh, and also the quote is in your querystring too. I forgot about that
part.

Ray at work

"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:egDVkbOjDHA.2300@TK2MSFTNGP10.phx.gbl...
> Well, your plus is in your querystring then. Your URL must look like

this:
>
>
> yoursite.com/page.asp?nryear=+2003 or yoursite.com/page.asp?nryear=%2B2003
>
> You'll see this if you do:
>
> RESPONSE.WRITE REQUEST.QUERYSTRING("NRYEAR")
> RESPONSE.END
>
>
> Ray at work
>
> "Julian Rickards" <julian.rickards@ndm.gov.on.ca> wrote in message
> news:uDjOOYOjDHA.3192@TK2MSFTNGP11.phx.gbl...
> > HI:
> >
> > I hope this isn't being double posted - I tried to post a response
> > directly to DevDex but it hasn't appeared after about 30 minutes of
> > waiting.
> >
> > OK, here is the code:
> >
> > NRYear = Request.QueryString("nryear")
> > StartOfYear = "1/1/" & NRYear
> > EndOfYear = "12/31/" & NRYear
> > SQLWhereString = "newsreleases.nrdate Between " & StartOfYear & " And "
> > & EndOfYear
> >
> > Response.Write SQLWhereString
> >
> >
> > The output from the response.write is (copied and pasted exactly as
> > output):




Bob Barrows 10-07-2003 03:57 PM

Re: Why is Request.QuerySting being treated as a number?
 
As Ray suggested, show us what you get when you do this:

Response.Write NRYear

Bob Barrows

Julian Rickards wrote:
> OK, here is the code:
>
> NRYear = Request.QueryString("nryear")
> StartOfYear = "11/1/" & NRYear
> EndOfYear = "12/31/" & NRYear
> SQLWhereString = "newsreleases.nrdate Between " & StartOfYear & "
> And " & EndOfYear
>
> Response.Write SQLWhereString
>
> and the Response.Write spits out (exactly as pasted below):
>
> newsreleases.nrdate Between 11/1/+2003" And 12/31/+2003"
>
>
> I am building a search form where the user selects the year and I am
> trying to build a between clause from the year selected.
>
> Jules
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!




Don Verhagen 10-07-2003 03:58 PM

Re: Why is Request.QuerySting being treated as a number?
 
In news:%235mmNYOjDHA.3192@TK2MSFTNGP11.phx.gbl,
Julian Rickards <julian.rickards@ndm.gov.on.ca> typed:
: OK, here is the code:
:
: NRYear = Request.QueryString("nryear")


Add a Response.Write ("NRYear = " & NRYear)

To see what is actually in the QueryString. I think you are assuming it's a
concatination problem when it could very well be a data problem.

Don



: StartOfYear = "11/1/" & NRYear
: EndOfYear = "12/31/" & NRYear
: SQLWhereString = "newsreleases.nrdate Between " & StartOfYear & "
: And " & EndOfYear
:
: Response.Write SQLWhereString
:
: and the Response.Write spits out (exactly as pasted below):
:
: newsreleases.nrdate Between 11/1/+2003" And 12/31/+2003"
:
:
: I am building a search form where the user selects the year and I am
: trying to build a between clause from the year selected.
:
: Jules
:
: *** Sent via Developersdex http://www.developersdex.com ***
: Don't just participate in USENET...get rewarded for it!




All times are GMT. The time now is 07:00 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.