top
Loading...
SQL2005中異常處理消息框可直接使用

使用了一段時間的SQL2005之后,發現里面的異常處理消息框(ExceptionMessageBox)功能很不錯。













以關聯相應幫助,復制到剪貼板或者是查看詳細的技術信息

分析了一下相關文件,發現這個功能包含在C:Program FilesMicrosoft SQL Server90Shared目錄下的Microsoft.NetEnterpriseServers.ExceptionMessageBox.dll中,可以在.net工程中直接引用,調用示例如下:

示例1

try{    string[] aa = new string[1];    aa[1] = "數組越界哈";}catch (Exception ex){    ExceptionMessageBox box1 = new ExceptionMessageBox(ex);    box1.Show(this);}

示例2

ExceptionMessageBox box1 = new ExceptionMessageBox("一個簡單的問題,你確認執行操作么?");box1.Symbol = ExceptionMessageBoxSymbol.Question;box1.Buttons = ExceptionMessageBoxButtons.YesNo;box1.Caption = "問一下啊";DialogResult dr = box1.Show(this);string msg = string.Empty;switch (dr){    case DialogResult.Yes:       msg = "你選擇了【是】";        break;   case DialogResult.No:        msg = "你選擇了【否】";        break;}MessageBox.Show(msg);

另外,還應該把C:Program FilesMicrosoft SQL Server90Sharedzh-CHS下的Microsoft.NetEnterpriseServers.ExceptionMessageBox.resources.dll拷出來,這個是相應簡體中文資源

(T114)

作者:http://www.zhujiangroad.com
來源:http://www.zhujiangroad.com
北斗有巢氏 有巢氏北斗