469,362 Members | 2,441 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,362 developers. It's quick & easy.

Redirect with variable

I'm redirecting a value to a page called update.asp from somepage.asp

Recid = Request.QueryString("qryCategory")
Response.redirect "update.asp?" & Recid

So it shows like /update.asp?3
My question is how do i grab that value (3)
and then use it in a query.

Thanks
Jul 19 '05 #1
5 8089
Response.Redirect "update.asp?rec=" & Recid

then Request.QueryString("rec") to get the value
--
Curt Christianson
Owner/Lead Developer, DF-Software
www.Darkfalz.com
"alexz" <al*****@hotmail.com> wrote in message
news:43**************************@posting.google.c om...
I'm redirecting a value to a page called update.asp from somepage.asp

Recid = Request.QueryString("qryCategory")
Response.redirect "update.asp?" & Recid

So it shows like /update.asp?3
My question is how do i grab that value (3)
and then use it in a query.

Thanks

Jul 19 '05 #2
you would need to put the "3" in a querystring. So the redirect should go
to:
update.asp?ID=3
then to get the value of ID in the next page, you would use
abc = request.querystring ("ID")

good luck
"alexz" <al*****@hotmail.com> wrote in message
news:43**************************@posting.google.c om...
I'm redirecting a value to a page called update.asp from somepage.asp

Recid = Request.QueryString("qryCategory")
Response.redirect "update.asp?" & Recid

So it shows like /update.asp?3
My question is how do i grab that value (3)
and then use it in a query.

Thanks

Jul 19 '05 #3
Rafael Chemtob wrote on 11 feb 2004 in
microsoft.public.inetserver.asp.general:
you would need to put the "3" in a querystring. So the redirect
should go to:
update.asp?ID=3
then to get the value of ID in the next page, you would use
abc = request.querystring ("ID")


It is the best way, but not "need"

update.asp?3

==========================

abc = request.querystring

gives as value for abc: 3
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 19 '05 #4

Recid = Request.QueryString("qryCategory")
Response.redirect "update.asp?" & Recid

and then

StrRecid = Request.QueryString("rec")

works and i do get the value passed.
And the i get a new problem.

As a test i do have this working
rs.Source = "SELECT * FROM courseReg WHERE(((courseReg.CourseID)=3))"
line 24 rs.CursorLocation = 2
line 25 rs.LockType = 3
line 26 rs.Open()

But when i try

rs.Source = "SELECT * FROM courseReg WHERE (((courseReg.CourseID) = " &
StrRecid & ")) "
rs.CursorType = 0

Microsoft JET Database Engine error '80040e14'
Extra ) in query expression '(((courseReg.CourseID) = ))'.
update.asp, line 26

I know i pass the correct value i just don't understand
why this code giving problems.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #5
Alex zurab wrote:

rs.Source = "SELECT * FROM courseReg WHERE (((courseReg.CourseID) = "
& StrRecid & ")) "
rs.CursorType = 0

Microsoft JET Database Engine error '80040e14'
Extra ) in query expression '(((courseReg.CourseID) = ))'.
update.asp, line 26

I know i pass the correct value i just don't understand
why this code giving problems.
It's pretty obvious that StrRecid does not contain what you think it
contains. And here is why: Recid = Request.QueryString("qryCategory")
Response.redirect "update.asp?" & Recid


You did not name the querystring variable in the redirect statement. It
should be:
Response.redirect "update.asp?rec=" & Recid
To help you better debug these things, never assign a concatenated string
directly to an object's property. Always assign it to a variable, and
subsequently use the variable in the code. This will allow you to write the
variable to the response to see what it contains. Like this (I'm getting rid
of those unneeded and confusing parentheses):

sSQL="SELECT * FROM courseReg WHERE courseReg.CourseID = "
sSQL = sSQL & StrRecid
'the following lines can be commented or deleted after debugging is done
'*******************************************
Response.Write sSQL
Response.End
'*******************************************
'it looks like you are opening a default cursor, so only one
'line is needed (you don't even need the "set rs=createobject" line):
set rs = conn.execute(sSQL,,1)

You only need to explicitly create and set the recordset's properties if you
need something other than the default, server-side, forward-only cursor.

HTH,
Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 19 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Donna Hawkins | last post: by
6 posts views Thread by Peter Row | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.