【发布时间】:2013-07-19 05:52:58
【问题描述】:
如何用c#代码识别sql存储过程引发的自定义错误信息?
存储过程会这样报错
RAISERROR (N'This is message %s %d.', -- Message text.
10, -- Severity,
1, -- State,
N'number', -- First argument.
5); -- Second argument.
从上面,如何识别错误是自定义错误消息。 (即)像这样的东西
try{
--actual code here
}
catch(SqlException ex)
{
--how to check here that the exception is custom one
}
【问题讨论】:
标签: c# sql-server-2008 raiserror