Click to See Complete Forum and Search --> : Formatting Data


Ian ORourke
October 16th, 2003, 07:07 AM
I have a simple application which has two controls:

DropDownList
DataList

When someone selects the DropDownList it connects to the database and binds the DataList using a DataReader (which only ever returns one row).

This works fine.

The problem I have is the data returned is padded. The CUSTNMBR field is padded with spaces, and the numbers are padded with trailing zeroes.

How do I remove these?

I've done some research and you can use the EVAL solution, but evrything I've read says try not to use it, format your data elsewhere - but I cannot find another way how to do it.

So, my data is coming back from the SQL Query with padded spaces, trailing zeroes and in date fields zero time values - how do I get rid of them for display?

Funnily enough when I use Query Builder on SQL Server it does not show this extra data, but when I return results with Query Analyser it does (as it does on the webpage)?