...

View Full Version : Summary...



christrinder
01-23-2003, 11:57 AM
Hello,

How would I select the first X-number of characters from a DB text field so that I could provide a summary (or rather the intro) of particular communications stored in my db. For example, assume I have a tutorial or something with lots of words, i.e. a long piece of text, but I want to display the first sentence so that viewers can get the gist of it's content before opening it.

Hope that makes sense, I would be really grateful for some pointers.

Regards,

Chris

bostjank
01-23-2003, 12:07 PM
I don't believe you can actually only retrieve first x characters from a particular field. You can, however, display only a part of the field. For example:



sField = rs("Field")

'first 100 characters
sDisplay = Left(sField,100) & "..."

'all the text before a certain character - if you want first sentence you may use .
sChr = "."
sDisplay = Left(sField,Instr(sField,sChr))

Response.Write sDisplay

Bostjan

Roelf
01-23-2003, 12:09 PM
http://www.codingforums.com/showthread.php?s=&threadid=12720



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum