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,14 +2875,21 @@ public static void ThrowDataException(Exception ex, int index, IDataReader reade
if (reader != null && index >= 0 && index < reader.FieldCount)
{
name = reader.GetName(index);
object val = reader.GetValue(index);
if (val == null || val is DBNull)
try
{
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);
......
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