























每次总是
catch(Exception ee)
{
MesageBox.Show(ee.Message);
}
昨天晚上看书,发现了fcl里面很多Exception 的继承类,可以提供更多的一场相关信息。今天找了OleDbException ,巴适!
catch(System.Data.OleDb.OleDbException ee)
{
for (int j=0; j < ee.Errors.Count; j++)
{
MessageBox.Show("Index #" + j + " " +
"Message: " + ee.Errors[j].Message + " " +
"Native: " + ee.Errors[j].NativeError.ToString() + " " +
"Source: " + ee.Errors[j].Source + " " +
"SQL: " + ee.Errors[j].SQLState + " ");
}
}
再比如System.ArgumentException.ParamName属性。呵呵,这样的东西还有很多。
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。