Commit 356c8621 authored by Young Pay's avatar Young Pay

ThrowDataException is not Complete

parent 885a8d46
...@@ -2639,14 +2639,21 @@ public static void ThrowDataException(Exception ex, int index, IDataReader reade ...@@ -2639,14 +2639,21 @@ 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
if (val == null || val is DBNull)
{ {
value = "<null>"; object val = reader.GetValue(index); // if there throw an exception, then I got one message, but Which column?
if (val == null || val is DBNull)
{
value = "<null>";
}
else
{
value = Convert.ToString(val) + " - " + Type.GetTypeCode(val.GetType());
}
} }
else catch (Exception valEx)
{ {
value = Convert.ToString(val) + " - " + Type.GetTypeCode(val.GetType()); 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);
...@@ -3610,4 +3617,4 @@ public partial class FeatureSupport ...@@ -3610,4 +3617,4 @@ public partial class FeatureSupport
#endif #endif
} }
\ No newline at end of file
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