ASP Syntax

Posted on 2003-03-18
Medium Priority
Last Modified: 2010-03-17
I'm doing a page where I'm showing 25 records at a time returned from a DB, when the next button is pressed I reload the page with a counter to count the next 25 records to be shown. The following is how I create my SQL Select statement based on a form Combo box selection. When the page is reloaded the strChoice variable is "" (null). so their is no SELECT statement created. How can I make sure that the strChoice variable is the same when I reload the page when the 'next' button is pressed?
I thought a request.querystring("strChoice") or something might work, no results yet.

'Request Combo Box Choice from Browse Form
strChoice = request.form("BrowseID")    
Set objConn = Server.createObject("ADODB.Connection")
objConn.open strConnect

if strChoice = 0 then      'Chose by Artist
       strSQL = "Select * from tblArtist, tblWork Where tblArtist.ArtistID = tblWork.ArtistID Order By tblArtist.LastName"
else                       'Chose by Title
       strSQL = "Select * from tblArtist, tblWork Where tblArtist.ArtistID = tblWork.ArtistID Order By tblWork.Title"
end if
Set objRS = Server.CreateObject("ADODB.recordset")
   objRS.open strSQL, strConnect
Question by:JesseSM
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 14

Accepted Solution

grimkin earned 200 total points
ID: 8274681

You could put a hidden field in your form when you retrieve the value for the first time, something like :
response.write ("<input type=hidden name=myChoice value=" & browseId & ">")

or you could put it in a session variable:

session("myChoice") = browseId

after which you can refer to it e.g.

if session("myChoice") = 0 then      
      strSQL = "xxx"
      etc etc

hope this helps


Featured Post

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Convert websphere application server default chained Certificates from 1024 to 2048 keysize or higher size and also you can change signatureAlgorithm . Please make sure Websphere Application Server fixpack or Above. The following steps a…
ADCs have gained traction within the last decade, largely due to increased demand for legacy load balancing appliances to handle more advanced application delivery requirements and improve application performance.
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question