Solved

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

Posted on 2016-11-21
4
66 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

729 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