Help with querystrings

This is a discussion on "Help with querystrings" within the Classic ASP section. This forum, and the thread "Help with querystrings are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > Classic ASP

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old May 29th, 2006, 18:33
New Member
Join Date: Dec 2005
Age: 21
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Help with querystrings

Hi i am new to ASP and trying to pull a querystring through another asp page i have done it on one of my other pages but this one will not. I have attached the code to this post. When i reqeust the querystring i am getting the correct value.

Any help would be appreciated.

thanks.

<%

sql = "SELECT * FROM tblNews WHERE ID = " & Request.Querystring("ID")
data_source = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("news.mdb")

' Creating Connection Object and opening the database
Set con = Server.CreateObject("ADODB.Connection")
con.Open data_source
set rs=server.createobject("ADODB.recordset")

rs.open sql, con

Response.Write(sql)
Response.write(rs("article_title"))


'Done. Close the connection
con.Close
Set con = Nothing

%>
Reply With Quote

  #2 (permalink)  
Old May 31st, 2006, 00:22
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 23
Posts: 1,649
Blog Entries: 1
Thanks: 0
Thanked 4 Times in 4 Posts
Re: Help with querystrings

The code is pretty straight forward and seems fine.

Possible ways to debug your code:

1. Make sure the request is correct.
Are your submiting actually the variable 'ID'?
URL should look via like this: page.asp?ID=whatever

2. Is the request being redirected?

3. Is the script being called in response to a 404 error?
Servers usually add the 404 error url to the query string.
This causes variables submitted to the original script to not be accessible via request.querystring
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
Reply With Quote
Reply

Tags
help, querystrings

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 15:00.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43