Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. 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 Databases 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 May 24th, 2005, 10:02 AM
Authorized User
 
Join Date: Sep 2003
Posts: 81
Thanks: 0
Thanked 0 Times in 0 Posts
Default Dissapearing VAR

I am loosing a Var that I need to show my database orderby

First i Dim the Var

  Dim orderSTR

Then pick the order in a drop down

  <option>Builder</option>
  <option>Last Shed</option>
  <option>Year Wdrn</option>
  </select>
  <input type="submit" value="Submit" />
  </form>

Then I have a case statement to get my Var and set my Orderby clause

  strOrderBy = trim(Request.QueryString("order"))
  Select Case strOrderBy
  Case "Builder"
     strOrderBy = "builder"
     orderSTR = "Builder"
  Case "Last Shed"
     strOrderBy = "last_shed"
     orderSTR = "Last Shed"
  Case "Year Wdrn"
     strOrderBy = "yy_wdn"
     orderSTR = "Year Withdrawn"
  End Select

I then use the Var orderSTR to show the orderby

Searched for Class <%= strSearch %> sorted by <%=orderSTR%> &nbsp;&nbsp;Found <%= irecordcount %> from <%= record_size %>&nbsp;&nbsp;Records.

This all works fine on the first page, BUT on the subsequent pages the var orderSTR just dissappears although strOrderBy and everything else works

I cannot see where i could be loosing it, if its there on the first page it made it thru, so why after a loop does it dissapear

If this is not enough code I will post the whole script but it is pretty large

Thanks Topshed

 
Old May 24th, 2005, 11:45 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Looks like you are missing to pass that as a querystring for each page. That should be where you would be missing. With the posted information, I can't think of anything else.

May be for the first page, when you submit from the form it works fine, but from there on you should be passing the needed information with the querystring to get that work. That is how it should be.

Let us know if that is where you go wrong.

_________________________
- Vijay G
Strive for Perfection
 
Old May 25th, 2005, 12:43 AM
Authorized User
 
Join Date: Sep 2003
Posts: 81
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Your right of course I do pass the stuff in a querystring and somehow forgot to add this one when I added the Variable

I use

  <a href="lnclass.asp?page=<%= I %>&amp;search=<% =Server.URLEncode(strSearch) %>&amp;order=<%= Server.URLEncode(strOrderBy) %>"><%= I %></a>

I am struggling with how to include it however I assume something like
&amp;orderSTR=<% =Server.URLEncode(orderSTR) %>

but that fell over (sigh)
any assistance would be great

Topshed


 
Old May 25th, 2005, 12:49 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Post here, what you see in the address bar as URL, when you click on that link that shows up for the <a href...> you posted in your previous post.

_________________________
- Vijay G
Strive for Perfection
 
Old May 25th, 2005, 09:17 AM
Authorized User
 
Join Date: Sep 2003
Posts: 81
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Fisrt page gives me this
http://britishsteam.com/up/lnclass.a...rder=Last+Shed

but page 2 and subsequent pages show this with correct page number

http://britishsteam.com/up/lnclass.a...er=last%5Fshed

Topshed

 
Old June 3rd, 2005, 01:34 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

I checked both your urls, it looks like in the first you are referring it as ORDER=LAST+SHED

But in the second, you are referring it as orderSTR=LAST+SHED

Thats what you are missing here. You got to keep it same in both places to get that work. Not sure if you are referring to the other one with in your code for other than 1st page.

_________________________
- Vijay G
Strive for Perfection





Similar Threads
Thread Thread Starter Forum Replies Last Post
var,text ,..... angelboy SQL Language 2 May 29th, 2007 11:37 AM
"Out of scope" var??? yankleber XSLT 2 March 31st, 2007 03:53 AM
var as variable incredi-man Javascript 2 September 16th, 2006 11:46 AM
Using a var into the name of another var or field. guizero Access VBA 3 May 30th, 2006 03:47 PM
Temp Var in For Each pbernardo XSLT 5 November 14th, 2003 06:45 PM





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