CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> Tips & Solutions

 Sorting on SQL type Text

Print topic Send  topic

Author Message
madkins

Posts: 1
Posted: 03/05/2009, 7:48 AM

I was shocked at how easy this was, so I had to share.
Let's say you have a field in your SQL database called "Description" and its datatype is Text.
If you use this in a grid, the sorter for that column will throw the following error at runtime: "The text, ntext, and image data types cannot be compared or sorted, except when using IS NULL or LIKE operator."
In CodeCharge, the solution is simple. Click on the sorter for the description field. Then under properties put the following (minus the quotes) in the Sort Order value: "Cast(Description AS Varchar(1000))"
This will, however, truncate the Description field but you probably shouldn't be displaying that much data in a grid anyways. Also, there will be a small performance hit since you are asking SQL to convert every one of the values in the grid, but it should only be noticable on large datasets.
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright 2003-2004 by UltraApps.com  and YesSoftware, Inc.