Commit f0dac59e authored by Marc Gravell's avatar Marc Gravell

Merge pull request #102 from youngpay/master

ThrowDataException is not Complete
parents 046dbcf4 356c8621
...@@ -2875,7 +2875,9 @@ public static void ThrowDataException(Exception ex, int index, IDataReader reade ...@@ -2875,7 +2875,9 @@ public static void ThrowDataException(Exception ex, int index, IDataReader reade
if (reader != null && index >= 0 && index < reader.FieldCount) if (reader != null && index >= 0 && index < reader.FieldCount)
{ {
name = reader.GetName(index); name = reader.GetName(index);
object val = reader.GetValue(index); try
{
object val = reader.GetValue(index); // if there throw an exception, then I got one message, but Which column?
if (val == null || val is DBNull) if (val == null || val is DBNull)
{ {
value = "<null>"; value = "<null>";
...@@ -2885,6 +2887,11 @@ public static void ThrowDataException(Exception ex, int index, IDataReader reade ...@@ -2885,6 +2887,11 @@ public static void ThrowDataException(Exception ex, int index, IDataReader reade
value = Convert.ToString(val) + " - " + Type.GetTypeCode(val.GetType()); value = Convert.ToString(val) + " - " + Type.GetTypeCode(val.GetType());
} }
} }
catch (Exception valEx)
{
value = valEx.Message;
}
}
toThrow = new DataException(string.Format("Error parsing column {0} ({1}={2})", index, name, value), ex); toThrow = new DataException(string.Format("Error parsing column {0} ({1}={2})", index, name, value), ex);
} }
catch catch
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment