Bläddra i källkod

2003-06-03 Ville Palo <[email protected]>

	* SqlBinary.cs: Changed one SqlTypeException --> IndexOutOfRange
	* SqlMoney.cs: checkings

svn path=/trunk/mcs/; revision=15090
Ville Palo 22 år sedan
förälder
incheckning
940ba904d5

+ 5 - 0
mcs/class/System.Data/System.Data.SqlTypes/ChangeLog

@@ -1,3 +1,8 @@
+2003-06-03  Ville Palo <[email protected]>
+
+	* SqlBinary.cs: Changed one SqlTypeException --> IndexOutOfRange
+	* SqlMoney.cs: checkings
+	
 2003-06-02  Ville Palo <[email protected]>
 
 	* SqlString.cs: implementes less than and greater than operators.

+ 1 - 1
mcs/class/System.Data/System.Data.SqlTypes/SqlBinary.cs

@@ -51,7 +51,7 @@ namespace System.Data.SqlTypes
 				if (this.IsNull)
 					throw new SqlNullValueException ("The property contains Null.");
 				else if (index >= this.Length)
-					throw new SqlNullValueException ("The index parameter indicates a position beyond the length of the byte array.");
+					throw new IndexOutOfRangeException ("The index parameter indicates a position beyond the length of the byte array.");
 				else
 					return value [index]; 
 			}

+ 22 - 18
mcs/class/System.Data/System.Data.SqlTypes/SqlMoney.cs

@@ -315,32 +315,35 @@ namespace System.Data.SqlTypes
 		}
 
 		public static explicit operator SqlMoney (SqlBoolean x)
-		{
-			checked {
-				if (x.IsNull) 
-					return Null;
-				else
+		{			
+			if (x.IsNull) 
+				return Null;
+			else {
+				checked {
 					return new SqlMoney ((decimal)x.ByteValue);
+				}
 			}
 		}
 
 		public static explicit operator SqlMoney (SqlDecimal x)
 		{
-			checked {
-				if (x.IsNull) 
-					return Null;
-				else
+			if (x.IsNull) 
+				return Null;
+			else {
+				checked {
 					return new SqlMoney (x.Value);
+				}
 			}
 		}
 
 		public static explicit operator SqlMoney (SqlDouble x)
 		{
-			checked {
-				if (x.IsNull) 
-					return Null;
-				else
+			if (x.IsNull) 
+				return Null;
+			else {
+				checked {
 					return new SqlMoney ((decimal)x.Value);
+				}
 			}
 		}
 
@@ -351,11 +354,12 @@ namespace System.Data.SqlTypes
 
 		public static explicit operator SqlMoney (SqlSingle x)
 		{
-			checked {
-				if (x.IsNull) 
-					return Null;
-				else
+			if (x.IsNull) 
+				return Null;
+			else {
+				checked {
 					return new SqlMoney ((decimal)x.Value);
+				}
 			}
 		}
 
@@ -392,7 +396,7 @@ namespace System.Data.SqlTypes
 			if (x.IsNull) 
 				return Null;
 			else
-				return new SqlMoney ((decimal)x.Value);
+				return new SqlMoney (x.Value);
 		}
 
 		public static implicit operator SqlMoney (SqlInt64 x)