Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP Professional For advanced coder questions in ASP 3. 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 Professional 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 October 30th, 2005, 01:16 PM
Authorized User
 
Join Date: May 2004
Location: chennai, tamil nad, India.
Posts: 66
Thanks: 0
Thanked 0 Times in 0 Posts
Default to optimize the code-urgent


Hi all,
Could anyone give me the optimized solution for my query

I have table called Appl_tbl with 4 columns

    ENo eName ecopies category


I need to display the data from tha above mentioned table.
depends upon the category I need to display static Heading

category are mgr,acc,clr,trn and are fixed
if mgr means "The List holds the details of mgr and their ......"

here i wrote the code like
dim Rs=server.createobject("ADODB.RECORDSET")

sub GetDetails()
strSql="Selec..... from tbl"
set Rs=objcon.execute(strSql)
end sub

'pass the recordset

sub displayMgr(rs)
rs.filter = " category= mgr"
if not rs.eof then

'display the static message

while not rs.eof
  response.write rs(0) & "-" rs(1)
 rs.movenext
wend
end if
end sub

like the above sub i wrote 3 sub for categories and filter the category and displayed
is that code optimized or wat else i should do for performance and readability
Love
Deepak













 
Old November 4th, 2005, 03:00 AM
Friend of Wrox
 
Join Date: Nov 2003
Location: Johannesburg, , South Africa.
Posts: 141
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to acdsky
Default

Hi

What database are you using? I would sugest using a where clause in your query. e.g strSQL = "Selec..... from tbl Where category = 'mgr'" and then make sure the category field is indexed by your DB Server. Selecting all data from a table without a where clause usually results in in DB server having to do a full table scan to return all the data. Query optimization should be done on DB/Table level according to your application queries.

Hope this helps.

Regards
Marnus




Similar Threads
Thread Thread Starter Forum Replies Last Post
Urgent:hard disk serial code and vb code ivanlaw Pro VB 6 0 July 25th, 2007 04:05 AM
optimize inesrt to MDB ishaywei Classic ASP Databases 1 November 27th, 2006 10:36 PM
Optimize SQL Statement JpJoe Access 1 June 7th, 2005 08:19 AM
Optimize Raul Classic ASP Databases 3 February 10th, 2004 02:08 PM





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