Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

URL and Querystring..?

Status
Not open for further replies.

kenjoswe

Technical User
Sep 19, 2000
327
SE
Hi all,
I have a URL that looks like which I use in a querystring to query a SQL-string:

URL=" and FieldName1='A'"
Response.Write &quot;<TD align=right><a href='&quot; & URL & &quot;'>&quot; & FormatNumber(rs.Fields(intColumn),0) & &quot;</a></TD>&quot;

When I look at the URL in the browser I just get:
&quot; and FieldName1=&quot;

What happend to the 'A' and how can I get it in the URL?

/Kent J.

 
I strongly suspect that you don't really want those single ticks in your url in the first place. I can't imagine why you would need them. I also see another problem...

I think you are wanting to say

&quot;&fieldName1=A&quot;

rather than &quot;and fieldName1=A&quot;

Correct me if I'm wrong, by all means, but know this... when you ask:

request.queryString(&quot;fieldName1&quot;)

you will get A

Then, if you need to enclose it in single ticks, then do so.

See if that works for you.

:)
Paul Prewett
penny.gif
penny.gif
 
Link 9,
Thanks for your reply.

I have an ASP-page where a can search a recordset dynamically. I can choose a fieldname, from a dropdown box, to search and I can set a criteria from the selected fieldname. The recordsets also returns a 'Sum' which I have managed by using '...with rollup..' in the SQL-string.

Now, when I click a URL on the row with 'Sum' and Sales in order to open a diagram I must know both the search criteria and the fieldname on which the criteria is based on. Then I can use the string in a SQL-query on the diagram page, like: sql=&quot;Select * from Table1 where x=1 &quot; & URL (URL=&quot;and Field1='A'&quot;)

If I can't use single ticks I guess I can retrive:
URL=&quot;and Field1=¤A¤&quot; instead in the querystring and use stringfunctions to single out the values A=&quot;and Field1=&quot; and B=&quot;A&quot; from the string.

/Kent J.







 
Have you tried using Server.URLEncode?

eg:
Response.Write &quot;<TD align=right><a href='&quot; & Server.URLEncode(URL) & &quot;'>&quot; & FormatNumber(rs.Fields(intColumn),0) & &quot;</a></TD>&quot;

hope this helps
leo
 
Vasah20,

Thanks!
Is there a good way to get rid of the &quot;+&quot; that Server.URLEncode creates (&quot;+and+Field1=+'A'&quot;) so that I can use the string in my SQL-query?

/Kent J.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top