SQL Server 2005中的異常處理消息框可以直接使用
使用了一段時(shí)間的SQL2005之后,發(fā)現(xiàn)里面的異常處理消息框(ExceptionMessageBox)功能很不錯(cuò)。可以關(guān)聯(lián)相應(yīng)幫助,復(fù)制到剪貼板或者是查看詳細(xì)的技術(shù)信息分析了一下相關(guān)文件,發(fā)現(xiàn)這個(gè)功能包含在C:Program FilesMicrosoft SQL Server90Shared目錄下的Microsoft.NetEnterpriseServers.ExceptionMessageBox.dll中,可以在.net工程中直接引用,調(diào)用示例如下:示例1 try { string[] aa = new string[1]; aa[1] = '數(shù)組越界哈'; } catch (Exception ex) { ExceptionMessageBox box1 = new ExceptionMessageBox(ex); box1.Show(this); }
示例2 ExceptionMessageBox box1 = new ExceptionMessageBox('一個(gè)簡(jiǎn)單的問(wèn)題,你確認(rèn)執(zhí)行操作么?'); box1.Symbol = ExceptionMessageBoxSymbol.Question; box1.Buttons = ExceptionMessageBoxButtons.YesNo; box1.Caption = '問(wèn)一下啊'; DialogResult dr = box1.Show(this); string msg = string.Empty; switch (dr) { case DialogResult.Yes: msg = '你選擇了【是】'; break; case DialogResult.No: msg = '你選擇了【否】'; break; } MessageBox.Show(msg);另外,還應(yīng)該把C:Program FilesMicrosoft SQL Server90Sharedzh-CHS下的Microsoft.NetEnterpriseServers.ExceptionMessageBox.resources.dll拷出來(lái),這個(gè)是相應(yīng)簡(jiǎn)體中文資源
