Decimal values won't save correctly

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
 
S

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
 
P

Prodip Saha

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
 

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