0
我需要根據錯誤代碼範圍區分sybase異常類型。區分Sybase異常類型
基本上我需要區分sybase系統相關的異常和數據異常。
我有用於處理sybase數據庫異常的c#代碼。
我們在異常中得到錯誤代碼,但我不知道定義錯誤代碼是sybase系統異常而不是數據異常的範圍。
我需要以不同的方式處理這兩個異常。
有人可以幫助這個。
複製下面的代碼。
using System.Data.Common;
int Range1 = 0;
int Range2 = 2000;
try
{
// Sybase data base operation
}
catch (DbException e)
{
// Sybase system exception like database space not availabe , Time out error
if(e.ErrorCode > Range1 && e.ErrorCode< Range2)
{
// This is system excpetion so dump the data to be reprocessed after database is up .
}
// Excpetions like referential integrity violation , value is more than max length
else
{
// This is data releted exception so Don't process this data again as the data itself is wrong
}
}