New tests.
[mono.git] / mcs / class / Mono.Data.Tds / Mono.Data.Tds.Protocol / Tds70.cs
index a7c78a0f9e4a57fa2c780cb2b7edcc10072aade9..57fb0914645e385fc2638e012dba459829845478 100644 (file)
@@ -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;                            
+                               }
                        }