ASP Forum
First few caracters/words from a field
fredmjf | Posted 4:28am 6. February 2008 Server Time |

Hello,

The following question:

To select a newsitem from my Access database i use the following query:

sSQL = "SELECT TOP 1 * FROM TblNews Order by Date DESC"
  Set oItems = oConnection.Execute(sSQL)

To show just the first 6 words from the article I put a part of the textfield in a separate field called 'Intro'

Then i'll show that field by :
<%=oItems("Intro")%>

Is there any possible solution to get the first x caracters/words from a field so i don't have to do all the extra work?

Thanks,
Fred
katy8439 | Posted 5:59am 6. February 2008 Server Time |

Try:

<%=Left(oItems("Intro"), 6)%>

Would show the first 6 Characters of the string
mp3cdman | Posted 5:45pm 6. March 2008 Server Time |

it will be easy to show only 6 (or n, where n=1 to 10000 or more) words by writing a simple function...

let me know if you need any help...

mp3cdman ;-P


Reply to Post First few caracters/words from a field



Back to Forum Page