• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 160
  • Last Modified:

ASP Syntax

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
0
JesseSM
Asked:
JesseSM
1 Solution
 
grimkinCommented:
hi,


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"
else                      
      etc etc

hope this helps

ben
0

Featured Post

The eGuide to Automating Firewall Change Control

Today‚Äôs IT environment is constantly changing, which affects security policies and firewall rules. Discover tips to help you embrace this change through process improvement & identify areas where automation & actionable intelligence can enhance both security and business agility.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now