Solved

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

Posted on 2016-11-21
4
52 Views
Last Modified: 2016-12-24
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 33

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 33

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I met Paul Devereux (@pdevereux) today when I responded to his tweet asking “Anybody know how to automate adding files from disk to a folder in #outlook  ?”.  I replied back and told Paul that using automation, in this case scripting, to add files t…
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…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

786 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