DataReader values and .ToString

M

Michel Vanderbeke

Hello,

In order to avoid errors, I have all my DataReader-fields converted with a
..ToString.
This in case some record could have Null-fields and an error would be
thrown.

This works fine, except for "money" fields in SQL-Server.
When I enter e.g. ? 2,50 and I read it back with a DataReader without
..ToString, I get the correct display.
However using .ToString, I get no valuta-sign and the value is multiplied by
10 000.

When trying to StringFormat the DataReader.ToString, I get a syntax error.

Can someone explain this to me an offer some help?

Many thanks and greetings,

Michel
 
W

William Vaughn

To avoid spending a lot of time coding, I send all of my DataReader output
to a DataTable via the Load method.
This deals with a litany of issues--one of which you describe here...

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant, Dad, Grandpa
Microsoft MVP
INETA Speaker
www.betav.com
www.betav.com/blog/billva
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top