For Programmers: Free Programming Magazines  


Home > Archive > ASP > March 2008 > Set limit of charactures returned from a DB









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Set limit of charactures returned from a DB
Bam

2008-03-05, 6:57 pm

I am trying to search this, but maybe I am not searching for the right
thing.

I have sql DB, and I have code to retrieve the information I want.

What I need is to be able to limit the number of charactures retrieved.
I am writing a pm system, and I want to display the first 50 charactures of
a post, then have the user click to read to get the rest of it.

example....

the post is abcdefghijklmnopqrstuvwxyz

but for the abbreviation of the post, i want it toshow abcdefghijklm......
which would be 13

the retrieve i have is pm_message =
trim(pm1.fields.item("fieldname").value)

how would I constrict the return on this??

i would appreciate a solution, or a better way to search for it.
thanks
Bam


Bob Barrows [MVP]

2008-03-05, 6:57 pm

Bam wrote:
> I am trying to search this, but maybe I am not searching for the right
> thing.
>
> I have sql DB, and I have code to retrieve the information I want.
>
> What I need is to be able to limit the number of charactures
> retrieved.
> I am writing a pm system, and I want to display the first 50
> charactures of a post, then have the user click to read to get the
> rest of it.
>
> example....
>
> the post is abcdefghijklmnopqrstuvwxyz
>
> but for the abbreviation of the post, i want it toshow
> abcdefghijklm...... which would be 13
>
> the retrieve i have is pm_message =
> trim(pm1.fields.item("fieldname").value)
>
> how would I constrict the return on this??
>
> i would appreciate a solution, or a better way to search for it.
> thanks


?
What's wrong with using the Left() function? Both T-SQL and vbscript
have their own versions of this function, so you can use it in your sql
statement when retrieving the data (select left(fieldname,13) as
abbreviation ...), or in your vbscript statement when assigning the
string to your variable.

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.


Bam

2008-03-05, 6:57 pm

"Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message
news:%23AKjtUvfIHA.4164@TK2MSFTNGP05.phx.gbl...
> Bam wrote:
>
> ?
> What's wrong with using the Left() function? Both T-SQL and vbscript
> have their own versions of this function, so you can use it in your sql
> statement when retrieving the data (select left(fieldname,13) as
> abbreviation ...), or in your vbscript statement when assigning the
> string to your variable.
>


Nothing wrong with that, just didn't think about it.
Sometimes the simplest things slip away from me. Thanks again!!!


Jeff Dillon

2008-03-05, 6:57 pm

I would return the whole string from the db, and handle this client side, so
you don't need to make 2 trips to the server

Jeff

"Bam" <bam@gig-gamers.com> wrote in message
news:47ceeef7$0$22793$4c368faf@roadrunne
r.com...
>I am trying to search this, but maybe I am not searching for the right
>thing.
>
> I have sql DB, and I have code to retrieve the information I want.
>
> What I need is to be able to limit the number of charactures retrieved.
> I am writing a pm system, and I want to display the first 50 charactures
> of a post, then have the user click to read to get the rest of it.
>
> example....
>
> the post is abcdefghijklmnopqrstuvwxyz
>
> but for the abbreviation of the post, i want it toshow
> abcdefghijklm...... which would be 13
>
> the retrieve i have is pm_message =
> trim(pm1.fields.item("fieldname").value)
>
> how would I constrict the return on this??
>
> i would appreciate a solution, or a better way to search for it.
> thanks
> Bam
>



Bam

2008-03-05, 6:57 pm


that's what i actually did.
set 2 variables, one for the abrev, and one for the complete

thanks again!!


"Jeff Dillon" <jeffdillon@hotmailremove.com> wrote in message
news:OKwQvfvfIHA.5088@TK2MSFTNGP02.phx.gbl...
>I would return the whole string from the db, and handle this client side,
>so you don't need to make 2 trips to the server
>
> Jeff
>
> "Bam" <bam@gig-gamers.com> wrote in message
> news:47ceeef7$0$22793$4c368faf@roadrunne
r.com...
>
>



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com