Decimal values won't save correctly

  • Thread starter Thread starter STom
  • Start date Start date
S

STom

I have tables in my SQL 2000 database that have all fields as decimal. Most
of them have a precision of 18 with a scale of 3.

If I look into my dataset before doing a dataadapter Update, I can see that
I have values such as 15.56, 0.67 etc.

Values such as 15.56 get saved as 16. Values such as 0.067 get saved as
'0'. I see no actual decimal values in my database tables.

Am I doing something wrong here? Why would I be rounding automatically or
losing values less than one?

Thanks.

STom
 
The problem was that I did not specify the precision and scale within the
declaration of the parameters of the stored procedures.

Thanks.

STom
 
Tom,
I don't know how you are defining the Parameters collection of the Command
object. I have very minimum information to answer precisely. I am almost
positive that your Paramater in question(decimal param) does not have the
correct Scale set. By default, .Net assign them to 0.

You can easily check the Scale property of the decimal Parameter on the
Command object in the immediate window before executing the Adapter.Update.

Prodip
 
Back
Top