I remember having this problem when upgrading from Studio 2002/Framework 1.0 to Studio 2003/Framework 1.1. All of a sudden, our decimal types no longer had the trailing zeros removed when populating values from a database.
I'd forgotten how I originally fixed this, so my first attempt this time was
dr.GetDecimal(1).ToString().Trim('0')
Unfortunately, this doesn't work as a 0 value will be effectively set to a zero length string. Further investigation led me to the following site
http://blogs.msdn.com/bclteam/archive/2004/06/01/145468.aspx
The answer is
dr.GetDecimal(1).ToString("G29")
Theme design by Jelle Druyts
Pick a theme: BlogXP calmBlue Candid Blue dasBlog Discreet Blog Blue Elegante essence Just Html MadsSimple Mobile Mono Movable Radio Blue Movable Radio Heat nautica022 orangeCream Portal Project84 Project84Grass Slate Sound Waves Tricoleur useit.com Voidclass2
Powered by: newtelligence dasBlog 1.9.6264.0
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.
© Copyright 2009, Noel Watson Consulting Ltd.
E-mail