Solved

Display first 3 lines of text from database field, vbscript asp

Posted on 2016-11-21
4
14 Views
Last Modified: 2016-11-25
I would like to pulll in the first three lines of a text field I call "teaser" that resides in a SQL database via VBscript and ASP.   There are only about 15 records.  Any ideas would be greatly appreciated.  Many thanks in advance.
0
Comment
Question by:meldraper
  • 2
  • 2
4 Comments
 
LVL 32

Accepted Solution

by:
Big Monty earned 500 total points
ID: 41896552
say you have a text field in the database called "teaser" and you access its contents like so:

dim teaser : teaser = rs("teaser")

this loads the contents into a variable called teaser. What you could do is only display x amount of characters (can't do "lines" as amount of text in 3 lines could change based off of screen format). To do this, you could do:

dim teaser : teaser = rs("teaser")
if teaser <> "" then
    numOfCharsToDisplay = 100
    teaser = Left( teaser, numOfCharsToDisplay )
end if

where numOfCharsToDisplay is the number of characters to display
0
 

Author Comment

by:meldraper
ID: 41896577
PERFECTO.  Exactly what I was looking for.  Many thanks.
0
 
LVL 32

Expert Comment

by:Big Monty
ID: 41896582
glad to have helped
0
 

Author Closing Comment

by:meldraper
ID: 41901929
Worked perfectly. Thank you.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now