Solved

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

Posted on 2016-11-21
4
62 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
HOW CAN I TRANSFER AN COLUMN DATA TO ROW FOR ANALYSIS 7 42
Calculate age in Microsoft Word 10 56
Record locking on classic ASP 3 40
VB script help 23 36
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…
Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

730 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