Print Page | Close Window

First 50 characters

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Database Discussion
Forum Description: Discussion and chat on database related topics.
URL: https://forums.webwiz.net/forum_posts.asp?TID=8499
Printed Date: 30 March 2026 at 7:27am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: First 50 characters
Posted By: Boecky
Subject: First 50 characters
Date Posted: 02 January 2004 at 1:09pm
Hey, how can i make a sql command to get only the first 50 characters of a record? I mean from record 1 the first 50 chars and the rest of the records complete like always.



Replies:
Posted By: Mart
Date Posted: 02 January 2004 at 1:15pm
SELECT Left(column, 50) FROM table;


Posted By: Boecky
Date Posted: 02 January 2004 at 7:12pm

strCommand = "Select Left(Message, 5) from tblNews"

and this in my html:
<%# binder.Eval(Container.Item, "Message") %><%# Databinder.Eval(Container.DataItem, "Message") %>

i get this error:
DataBinder.Eval: 'System.Data.Common.DbDataRecord' does not contain a property with the name Message.

When i'm doing the left function away it works...hmm what i'm doing wrong? It's almost 1:30 am here, i can't see the fault



Posted By: Mart
Date Posted: 03 January 2004 at 5:55am

Try this:

Select Left(Message, 5) As [Message] from tblNews



Posted By: Boecky
Date Posted: 03 January 2004 at 7:54am
thanks, works great!



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net