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 February 25th, 2004, 09:18 AM
Authorized User
 
Join Date: Feb 2004
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?

 
Old February 25th, 2004, 10:23 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
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)
 
Old February 25th, 2004, 12:04 PM
Authorized User
 
Join Date: Feb 2004
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!

 
Old February 25th, 2004, 03:58 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
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.





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





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