p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

proasp_codeclinic thread: Process Question


Message #1 by Bobby Johnson <bobby@s...> on Wed, 14 Nov 2001 08:18:51 -0800
IMO, you should limit the text to what you need in the database. First of 
all, ASP is not very fast at handling strings, but more important, it saves 
you heavy data transfer from the database to the webserver (even if they 
reside on the same machine).

IMO, you should always just get what you need.

If you are using SQL server, you can use the Left function.

 From the BOL: LEFT ( character_expression , integer_expression )

This will return just the first integer_expression number of characters 
from the field you are querying.

Other DBMS's most likely support left (or a variation on it) as well

HtH

Imar


At 08:18 AM 11/14/2001 -0800, you wrote:
>Greetings all!
>
>I am rewriting a site news script that can be found here:
>http://www.webwizguide.com/asp/sample_scripts/discussion_forum_script.asp
>
>This script gives me a good place to start to get what I want to achieve. If
>you look at the sample news script on that page, you will see that the
>entire story is displayed. I would prefer to limit the amount of the story
>that is displayed to the end user on the main news site giving them the
>option of reading the rest by clicking a MORE link ala this site:
>
>http://www.slashdot.org
>
>My question is which is the better way to accomplish this. Should I pull the
>entire contense of the DB field back and manipulate it in script to limit
>the number of characters displayed or should I format my SQL query so that
>it only pulls back what I need to render the page?
>
>I am thinking the second option is the best choice because it limits the
>effort put on the scripting engine.. but I cant for the life of me figure
>out how to limit the characters returned from a single field.
>
>Any suggestions?
>
>      ----------------------------------------------------------
>Bobby Johnson
>       Knowledge Manager, Adobe
>       SafeHarbor Technology Corporation
>       Satsop Development Park
>       P.O. Box 37
>       Satsop, Wa 98583-0037
>E-mail: bobby@s...
>Voice:  xxx.xxx.xxxx
>Pager:  xxx.xxx.xxxx
>Email Pager:3605345546@m...
>       Internet: http://www.safeharbor.com
>------------------------------------------------------
>
>Experience is nothing more than the opportunity to practice your mistakes.
>-AC Slashdot.org
>
>
>
>
>$subst('Email.Unsub')



  Return to Index