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 June 1st, 2006, 05:35 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default bring together MySQL hits in ASP script

Code:
<%
set rsLadd = conn.execute("SELECT ladder_name,game_name,area FROM `ladders` WHERE power = '0'", ,adCmdText)
set rsPwrLadd = conn.execute("SELECT ladder_name,game_name,area FROM `ladders` WHERE power = '1'", ,adCmdText)
set rsTour = conn.execute("SELECT tournament_name,game_name,area FROM `tournaments`", ,adCmdText)
set rsLeague = conn.execute("SELECT league_name,game_name,area FROM `leagues`", ,adCmdText)
%>

        <tr>
            <td class="font_Sec_Headings" width="10%">
            <select name="pwr_ladd" id="pwr_ladd">
                <option>Please Select</option>
                <% if (NOT rsPwrLadd.eof) AND (NOT rsPwrLadd.bof) AND (Response.IsClientConnected) then %>
                    <% do until rsPwrLadd.eof %>                
                        <option><%=Trim(rsPwrLadd("game_name"))%>&nbsp;-&nbsp;<%=Trim(rsPwrLadd("area"))%>&nbsp;-&nbsp;<%=Trim(rsPwrLadd("ladder_name"))%></option>
                    <% rsPwrLadd.movenext
                       loop %>
                <%
                end if 
                rsPwrLadd.close
                Set rsPwrLadd = Nothing
                %>
            </select>
            </td>
        </tr>
I have this code all on one ASP script, what i was wondering was is there a quicker way to get it out the database and refer to it in the script?

I just felt that four SQL hits may be time consuming in real-time environment!

Picco

www.crmpicco.co.uk
www.ie7.com
__________________
_______________________
Ayrshire Minis - a Mini E-Community
http://www.ayrshireminis.com
http://www.crmpicco.co.uk
 
Old June 1st, 2006, 04:10 PM
Friend of Wrox
 
Join Date: May 2006
Posts: 643
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am not sure what you are asking... but you have created four recordsets but you are only using one of them: rsPwrLadd.
A little tip: you probably don't need the following line (unless you are really concerned with the IsClientConnected... which I suggest you shouldn't be).
Code:
<% if (NOT rsPwrLadd.eof) AND (NOT rsPwrLadd.bof) AND (Response.IsClientConnected) then %>
This line isn't needed because the do until rsPwrLadd.eof is sufficient - it will only loop if there is anything to loop through.

Perhaps you are asking if there is some way to cache the data that the recordsets are retrieving from the database? If this is the case, there are a number of ways to do this. One way to do this would be to retrieve the data for each select box once, use the data to create the HTML for each select box, and store each one in its own application variable. Then, whenever you need it just retrieve the HTML and insert it into your page as you render it.

Make sense?

Woody Z http://www.learntoprogramnow.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
problem connect to MySql from script sabra MySQL 1 July 25th, 2006 07:23 PM
c# MySQL script shaho C# 0 June 26th, 2006 09:35 AM
PHP script for MySQL yields white screen gnilly PHP Databases 2 November 30th, 2005 01:33 PM
asp file upload script having problems with MYSQL paulmcn Classic ASP Databases 0 September 16th, 2005 01:26 PM
How to script search form in PHP/MYSQL javabeans PHP How-To 0 January 12th, 2004 03:53 AM





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