我想捕获从SQL SERVER引发的INNER异常,并在WPF中的MessegeBox中显示该异常
先谢谢
答案 0 :(得分:-1)
您可以使用以下方法之一:
try
{
//Some commands that can raise an exception
}
catch (Exception e)
{
Exception inner = e.InnerException ?? e;
while (inner.InnerException != null)
{
inner = inner.InnerException;
}
//inner exception will contain the innerest exception
}