Decimal datatypes as 'money' (currency) in ADO.NET?

  • Thread starter Thread starter Steve Hiemstra
  • Start date Start date
S

Steve Hiemstra

Hi All,

I'm developing an application that needs to put 'money' (currency) values
into ANY OF Access, MS-SQL Server, and/or Oracle databases. Because they
all
have their own way of supporting 'Money' and .NET only gives us the
'System.Decimal' datatype to work with I am at a loss...

So far I've used the "System.<datatype>" compatible datatypes under .NET,
and let ADO.NET convert to the database of choice. SO, "System.Decimal" is
what I've been using for 'Money' (but each database type use something other
than 'decimal' for currency values, Access: 'Money' or 'Number', MS-SQL
Server: 'Money' or 'Decimal'...).

The problem is... I don't see how to specify the 'fractional' precision of
the Decimal value through ADO.NET.

Through ADO... how do I create the Column Schema parameters for a Decimal?
Do I set a database column up as a 'Money' or 'Number' value and set it's
internal parameters at the database-level (and let ADO use 'Decimal', hoping
it will all convert OK)?

I'm just trying to find the most compatible way to handle ADO sending
currency values to a variety of database types without getting too 'manual'
about it.

Any help is appreciated,

SteveH
 
Steve,

What is your problem. because your name is very Fries, I assume that you at
least know what I mean when I write the "decimaal comma". Is your point that
this is written and used in English as decimal point. When you do it right
and use the right culture and language settings, than that is all done for
you in Net. This is in my opinion one of the great benefits of Net.

I hope this helps,

Cor
 
Sorry Cor, but I live in Florida, USA. Good to see you noticed the 'Fries'
though, my grandfather was from Holland.

Being an 'english-only' person (nothing to be proud of), I was still having
problems using the right datatype in my databases to be compatible with the
..NET philosophy.

After writing my last message here I decided to customize my code so each
type of database (Access, MS-SQL Server, Oracle) would use whatever
'Currency' datatype was native to it. I still use 'System.Decimal' in my
..NET code as the datatype for my ADO DataColumns and ADO seems to be 'smart'
enough to translate from 'Decimal' to 'Currency' value in my databases.

Thanks for your help,

SteveH
 
Steve,
Sorry Cor, but I live in Florida, USA. Good to see you noticed the
'Fries' though, my grandfather was from Holland.
Probably he said Friesland.

Everybody who's name end on "stra" has probably his roots in Friesland. (I
am from Holland by the way). Both are former states of the Republic of the
Netherlands and now provincies.

:-)

Cor
 
Back
Top