Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 25th, 2004, 09:18 AM
Authorized User
 
Join Date: Feb 2004
Location: , , .
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default Reading data from database...

Hi there!

Im working on a text-application that lets you read a small text from the database on the startpage, and when you press "read more" you will get to read the whole text.

The "small" text may differ in leanght from different records, but I want my ASP code to limit the number of letters shown on the startpage (say a maximum of 350 letters) dispite the small text leangth (even if it is over 500 letters long, I still want only 350 letters show'n on the startpage). After 350 letters I want the ASP code to generate a "..." and "read more".

Anyone who knows how to make this possible?

Reply With Quote
  #2 (permalink)  
Old February 25th, 2004, 10:23 AM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Use the Left() function to get the left most X characters of a string.

Left(myString, 350)
Reply With Quote
  #3 (permalink)  
Old February 25th, 2004, 12:04 PM
Authorized User
 
Join Date: Feb 2004
Location: , , .
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default

It worked, thank you planoie! :)

I had imagined that it would include more string manipulation, but this was pretty easy... Oh well, great now that it works!

Reply With Quote
  #4 (permalink)  
Old February 25th, 2004, 03:58 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Well, you might consider a more advanced truncation such that you don't end up with a string getting truncated right in the middle of a wor...

You could look in the string at the character position you want to truncate at, then back up until you hit a space so that the truncation stops after a whole word.

Peter
------------------------------------------------------
Work smarter, not harder.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
reading image from database reza_ahmadi Java Espanol 4 March 8th, 2009 09:35 AM
Reading images from Database shankhan Classic ASP Databases 1 March 21st, 2005 01:36 AM
Reading from database larry101 Classic ASP Databases 5 September 23rd, 2004 03:43 PM
How can I reading InterBase database not24 C# 2 September 21st, 2004 12:51 AM
Reading data from files and writing it to database enggalok VS.NET 2002/2003 1 February 24th, 2004 12:33 AM



All times are GMT -4. The time now is 01:14 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.