Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 23rd, 2003, 07:53 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Jeff,

I'm glad you got it Jeff, but I don't know how that code could have worked.

I thought you would need to assign the request variable to the variable BID.


Code:
Dim BID
BID = request("BID") 'otherwise BID would be and empty string ""
sSQL = "SELECT Name, Info, Bio, URL FROM Table1 WHERE ID = " & BID
 
Old June 24th, 2003, 03:29 PM
Authorized User
 
Join Date: Jun 2003
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You are correct, I left off the Request.Querystring in the posting
here because that I assumeb we all know had to be included.

One More Question
I have two pages

Page One Has a Link
<a href=alph.asp?LET=#039;A#037;#039;>A</a>
which looks like
alph.asp?LET='A&%'
when it is passed through the browser
So LET is defined as 'A%'
Page Two Requests the querystring
DIM LET

LET = Request.QueryString("LET")
sSQL = "SELECT * FROM Bands Where BandName Like " & LET

I just want the page alph.asp to display records that start
with A if I click A on Page One or records that start with
B when I click B on Page One

Is my url written wrong?
Is the Select line wrong?

I did this same think with the BID and it worked fine
Then again I was looking for one record and not a
bunch that start with one letter.

I tested this with
sSQL = "SELECT * FROM Bands Where BandName Like 'A%' "
This worked.
So how do I tell the second page what letter to put 'HERE%'
And allow the second page to accept it?

Jeff Henderson
President-Worship Loud
http://www.worshiploud.com
 
Old June 24th, 2003, 07:41 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Default

The easiest way is to do string formatting on the second page and just pass the letter in the query string.

Code:
<a href="alph.asp?LET=A">A</a>

'on your second page the string would be built as

sSQL = "SELECT * FROM Bands Where BandName Like '" & LET & "%'"
The problem with the way you were doing it is probably has to do with the way the browser encripts the caracters ',& and %.
You can response.write the SQL string to see what is being produced by your code before it goes to SQL Server.
 
Old June 24th, 2003, 11:03 PM
Authorized User
 
Join Date: Jun 2003
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

On a normal server setup that would work.
I am on Brinkster. Normal things don't work
on Brinkster.I will keep at it.
The way I figured out the earlier problem
was by adding or removing things.
Like " or ' or %
This is probably the same thing.

Jeff Henderson
President-Worship Loud
http://www.worshiploud.com
 
Old June 24th, 2003, 11:16 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Default

If
Code:
sSQL = "SELECT * FROM Bands Where BandName Like 'A%' "
works then
Code:
sSQL = "SELECT * FROM Bands Where BandName Like '" & request("LET") & "%' "
Also would work!
This is fundamental ASP Code, I am sure brinkster would support this.

You should try this again.
Remove the special caracters from your tag on the first page so it looks like.
Code:
<a href="alph.asp?LET=A">A</a>
and change your query string to look like this.
Code:
sSQL = "SELECT * FROM Bands Where BandName Like '" & request("LET") & "%' "
 
Old June 25th, 2003, 07:03 PM
Authorized User
 
Join Date: Jun 2003
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I think that the issue is Brinkster.
For instance,
<a href="alph.asp?A">A</A>
only works like
<a href=alph.asp?A>A</A>

In addition to that remember earlier in this string where
someone had posted this line
strSQL = "select BIO from BANDS where ID = " & request("BID")
well that line did not work on Brinkster but this did
sSQL = "SELECT Name, Info, Bio, URL FROM Table1 WHERE ID = " & BID

That is why I was thinking maybe the syntax is not
compatable with Brinkster.

Your suggestion did not work. I don't get why.
I understand that it should work, but it does not.

That is why I tried to embed the entire thing in the Link.

I will continue to work on it.

Jeff Henderson
President-Worship Loud
http://www.worshiploud.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
how to display data in MSHFlexgrid Swati Chari VB How-To 3 July 22nd, 2008 10:15 AM
Display data within data range? ktsis ASP.NET 1.0 and 1.1 Basics 2 June 9th, 2006 03:06 PM
display data in the dropdown vivek_inos Access VBA 1 November 25th, 2005 07:02 PM
Display data in a subform marcin2k Access VBA 1 March 1st, 2005 04:37 PM
Display Data. mistry_bhavin ADO.NET 2 May 4th, 2004 09:22 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.