diff options
Diffstat (limited to 'mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds70.cs')
-rw-r--r-- | mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds70.cs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds70.cs b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds70.cs index a7c78a0f9e4..57fb0914645 100644 --- a/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds70.cs +++ b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds70.cs @@ -563,6 +563,14 @@ namespace Mono.Data.Tds.Protocol if ( param.TypeName == "decimal" || param.TypeName == "numeric") { Comm.Append ((param.Precision !=0 ) ? param.Precision : (byte) 29); Comm.Append (param.Scale); + // Convert the decimal value according to Scale + if (param.Value != null && param.Value != DBNull.Value && + ((decimal)param.Value) != Decimal.MaxValue && + ((decimal)param.Value) != Decimal.MinValue) { + decimal expo = new Decimal (System.Math.Pow (10, (double)param.Scale)); + int pVal = (int)(((decimal)param.Value) * expo); + param.Value = (decimal)pVal; + } } |