decimal precision

S

silenius

I got a problem

when i transfer data form the dataset to the database, the decimal value are
truncated and not rounded.
Is there a way to round them automaticly. if not, how can i retrieve the
precision of the decimal in the database in dot.net to do the rounding
before?

thanks
 
V

Val Mazur

Hi,

This is a text from MSDN documentation

".NET Framework data providers that ship with .NET Framework version 1.0 do
not verify the Precision or Scale of Decimal parameter values. This can
result in truncated data being inserted at the data source.
If you are using .NET Framework version 1.0, validate the Precision and
Scale of Decimal values before setting the parameter value. When using .NET
Framework version 1.1 or later, an exception is thrown if
a Decimal parameter value is set with an invalid Precision. Scale values
that exceed the Decimal parameter scale are still truncated."

So, when you create Command, which updates database from the dataset, you
could specify precision of the parameter, using Precision and Scale
properties of it.
 
V

Val Mazur

Hi,

When you use CommandBuilder it should do it automatically. If it does not do
it, then you could try to access specific command (Insert/Update/Delete) and
try to modify parameter there
 

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