Sorting a recordset? Or a better way to do this .

Results 1 to 3 of 3

Thread: Sorting a recordset? Or a better way to do this .

  1. #1
    Meehu Guest

    Default Sorting a recordset? Or a better way to do this .

    I&#039;m trying to display a list of products in a select list. The product names will be pulled from an Oracle database. Currently, there are around 470 different products, so I want to be able to put links on the top of the page that will let the user select an alphabetical category (e.g. "A", "B-C", etc.) and list only the products that fall in that category. That way, there should never be more than 40 or so products listed at a time. I&#039;m trying to figure out what the best way would be to implement that, though. <BR><BR>I&#039;ve thought of a couple of possibilities, but I&#039;m not sure that any of them are the way to go:<BR><BR>I don&#039;t think I want to be requerying the database, so I&#039;m assuming I should pull all of the records down into a single recordset sorted by name. Then, I thought that I could perhaps cycle through the recordset once and copy each record into a separate recordset for the category that it should fall into? <BR><BR>Since all of the processing and the creation of the list is server-side, though, I can only change the contents of the list by completely refreshing the page, right? And to keep from requerying the database I would have to pass the recordset back to the page somehow. Is there a reasonable way to do this? Or is there another way to go about generating the list?

  2. #2
    Join Date
    Dec 1969

    Default one way would be to....

    extract all the data in one go into a local array, then use remote scripting from the browser to pull data from this array into a clent-side listbox (or another control) without having to load the page again.

  3. #3
    Join Date
    Dec 1969

    Default Your stuck with requerying the db

    unless you want to use xml data island or session var with a rs in it etc. Requerying is ok no big deal on resources as user gets a&#039;s say looks at lis for 30 seconds, looks at b&#039;s etc. No major hog on server so to do this do<BR><BR>&#060;a href="getdata.asp?aplha=a"&#062;a&#060;/a&#062; &#039;say for link<BR><BR>in getdata.asp do <BR>dim strAlpha, strSQL<BR><BR>strAlpha = Request.Querystring("Alpha")<BR><BR>strSQL = "Select Field1, Field2 From Table1 Where Field1 Like &#039;" & Alpha & "*&#039;"<BR><BR><BR>etc<BR><BR>assuming * is the wildcard fro oracle may be something else do some r&d on this to find out.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts