Hi, I have a function that does some calc and returns a decimal which i try to put into a datarow. so:
decimal myvar= SomeCalc(..);
//lets assume myvar=0.9 after calculation
//update the output row in place with value
newOutputRow["column"]= myvar;
But then when I do this in command window:
? newOutputRow[["column"] I get 1 back, not 0.9. Some the rounding happends when I assign the value to table cell as it is 0.9 after the procedure calll
I seen the same with other numbers, like 0.012 gets rounded to 0.
I tried using decimal and varchar column types for the output table:
Output.Columns.Add(new DataColumn("column", SqlDbType.VarChar.GetType())); or
Output.Columns.Add(new DataColumn("column", SqlDbType.Decimal.GetType()));
Why is it getting rounded up???
Thanks!
decimal myvar= SomeCalc(..);
//lets assume myvar=0.9 after calculation
//update the output row in place with value
newOutputRow["column"]= myvar;
But then when I do this in command window:
? newOutputRow[["column"] I get 1 back, not 0.9. Some the rounding happends when I assign the value to table cell as it is 0.9 after the procedure calll
I seen the same with other numbers, like 0.012 gets rounded to 0.
I tried using decimal and varchar column types for the output table:
Output.Columns.Add(new DataColumn("column", SqlDbType.VarChar.GetType())); or
Output.Columns.Add(new DataColumn("column", SqlDbType.Decimal.GetType()));
Why is it getting rounded up???
Thanks!