469,356 Members | 2,016 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

Response redirecting a querystring

Hi there,

I have a ASP/SQL 7.0 Application and i have a page (page1.asp) that has 2
ways of accessing it.

1 is through a hyperlink on another page (page2.asp), that inserts a value
into a querystring and page1.asp output data from sql according to the
relevant value in the hyperlink =
***page2***

<a href= "page1.asp?value=<% =RS("value")%>"><% =RS("value")%></a>

***page 1***
Set RS = DataConnection.Execute("SELECT fields FROM view WHERE view.col1='"
& request.querystring("value") & "'")
***********

This works OK and i can output the data fine in accordance to the select
statement.

The other way of accessing this page is through page3.asp, which has a text
box and upon clicking submit the value in the text box is put into the
querystring. (this value will be the same as the hyperlink on page 2)=

***page3.asp***

If Request.Form("btn") = "Submit" Then
If Request.Form("textbox") <> "" Then
Dim value
value = Request.Form("textbox")
Response.redirect("page1.asp?value='"& value &"'")
Else
Response.Write("Please enter your value")
End If
End If

**************

This doesnt work and returns a invalid syntax error, and also saying that
there is no record.
The URL has ' around the value. ie URL = .....page1.asp?value='value'
(rather than_ .....page1.asp?value=value
Why would 1 work and not the other????

Help (and sorry if its a tad confusing)

--
Thanks in advance

Fawke

Please remove ANTI and SPAM
from my email address before emailing me.

www.bradflack.com
Jul 19 '05 #1
7 3397
> This doesnt work and returns a invalid syntax error, and also saying that
there is no record.
The URL has ' around the value. ie URL = .....page1.asp?value='value'
(rather than_ .....page1.asp?value=value
Why would 1 work and not the other????


Remove the single quotes around the value - you're getting a syntax error
because those single quotes are also included in your sql statement.

R
Jul 19 '05 #2
i dont know where you mean? the quotes are needed for the -
Response.redirect("page1.asp?value='"& value &"'")
and when i remove the quotes manually in the URL, i get -

Error Type:
ADODB.Field (0x80020009)
Either BOF or EOF is True, or the current record has been deleted. Requested
operation requires a current record.
/ltsb/summary_BM.asp

i don't know why it can read 1 data string ok (and get a record), and not
another??? as both have the same name as the select statement.
--
Thanks in advance

Fawke

Please remove ANTI and SPAM
from my email address before emailing me.

www.bradflack.com
"Randy Rahbar" <rvrahbar@_JUNKETY_JUNK_hotmail.com> wrote in message
news:ei**************@TK2MSFTNGP09.phx.gbl...
This doesnt work and returns a invalid syntax error, and also saying that there is no record.
The URL has ' around the value. ie URL = .....page1.asp?value='value'
(rather than_ .....page1.asp?value=value
Why would 1 work and not the other????


Remove the single quotes around the value - you're getting a syntax error
because those single quotes are also included in your sql statement.

R

Jul 19 '05 #3
Response.write the sql statement....

Response.write "SELECT fields FROM view WHERE view.col1='" &
request.querystring("value") & "'")
Response.end

Do this at the top of page 1 and you can check out the values being passed
into the sql statement.
Jul 19 '05 #4
i cant as i cant display the page.
How should it look?

--
Thanks in advance

Fawke

Please remove ANTI and SPAM
from my email address before emailing me.

www.bradflack.com
"Randy Rahbar" <rvrahbar@_JUNKETY_JUNK_hotmail.com> wrote in message
news:ee**************@TK2MSFTNGP10.phx.gbl...
Response.write the sql statement....

Response.write "SELECT fields FROM view WHERE view.col1='" &
request.querystring("value") & "'")
Response.end

Do this at the top of page 1 and you can check out the values being passed
into the sql statement.

Jul 19 '05 #5
When it works, the URL has no - ' - but the SQL Statement does, at the top
of the page.

How should the response redirect work?
--
Thanks in advance

Fawke

Please remove ANTI and SPAM
from my email address before emailing me.

www.bradflack.com
"Randy Rahbar" <rvrahbar@_JUNKETY_JUNK_hotmail.com> wrote in message
news:ee**************@TK2MSFTNGP10.phx.gbl...
Response.write the sql statement....

Response.write "SELECT fields FROM view WHERE view.col1='" &
request.querystring("value") & "'")
Response.end

Do this at the top of page 1 and you can check out the values being passed
into the sql statement.

Jul 19 '05 #6
> How should the response redirect work?

When redirecting from page 3, remove the single quotes and just do something
like this..

page1.asp?value=" & value

If you get a BOF or EOF error on page1, then that value probably doesn't
exist in the database. After you make that change, response.write your sql
statement and see what you get.

Hopefully this all makes sense,
Randy
Jul 19 '05 #7
sorry about all that confusion, i did that and it all works. Aint ASP a
finacy thing (if your new)

Thanks for all your help

--
Thanks in advance

Fawke

Please remove ANTI and SPAM
from my email address before emailing me.

www.bradflack.com
"Randy Rahbar" <rvrahbar@_JUNKETY_JUNK_hotmail.com> wrote in message
news:Oe**************@TK2MSFTNGP10.phx.gbl...
How should the response redirect work?
When redirecting from page 3, remove the single quotes and just do

something like this..

page1.asp?value=" & value

If you get a BOF or EOF error on page1, then that value probably doesn't
exist in the database. After you make that change, response.write your sql statement and see what you get.

Hopefully this all makes sense,
Randy

Jul 19 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Mark | last post: by
2 posts views Thread by Stephan Bour | last post: by
3 posts views Thread by tshad | last post: by
12 posts views Thread by gigi | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.