Jump to content

How to read a part of a data from a table?


krajes

Recommended Posts

HelloI have a problem with getting a short text from my table.In topics there is a example how to read a part of a TextStream file, but I have to do it with my database. How to do it with text which is in a table in database?please help meKrajes

Link to comment
Share on other sites

To extract data from a database table rather than a textfile you need to create a connection to the database, query it using an SQL query string, and then use the recordset thats returned however you wish. You do all this using ADO, you may find the following article useful:ADO SQL QueryHopefully that covers what you needed to know!

Link to comment
Share on other sites

Hey, I know generally how to get data from the table, and all this things. My problem was with geting a part of data, first 100 characters from the text which is in database. Solution: SELECT left(your_column_name,100)as something from .......

Link to comment
Share on other sites

try this

     function ClipText(TheText, TheLength)     ' Test if needed first     if TheLength > 0 then       if (Len(TheText) > TheLength) then        TheText = Left(TheText, TheLength - 3) & "..."      end if     end if  	 ClipText = TheText      end function

and where you want to write the tekst you enterfirst you have to load your text into a variable like summaryand specify the amount of characters you want to show

<%=ClipText(summary, 300)%>

for examplethis will get the first 300 charactersthe text will be finished with three dots ...i hope it will help you out :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...