存放在C#中的SqlServer的RAISERROR消息 [英] Storing SqlServer's raiserror message in C#

查看:590
本文介绍了存放在C#中的SqlServer的RAISERROR消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何保存SQLSERVER的RAISERROR消息在C#

How can I store SQLSERVER's raiserror message in C# ?

推荐答案

这要看的的/msdn.microsoft.com/en-us/library/ms164086.aspx\">severity。严重性1-10被认为是信息的消息,不打破你的C#的客户端,即流动。他们不扔例外。这些信息的消息会引发你的连接在 InfoMessage 事件。

如果您有10和16之间的严重性RAISERROR被认为是一个错误,你SqlCommand.Execute将抛出和异常你可以赶上。

If you RAISERROR with severity between 10 and 16 is considered an error and your SqlCommand.Execute will throw and exception you can catch.

严重程度分别为不适合你用,他们只由引擎用来表示可采取数据库脱机或关机实例严重问题玩。在技​​术上是不可能的,级别高于25至引发错误,严重性100的例子只是愚蠢。

Severities above 17 are not for you to play with, they are only to be used by the engine to indicate severe problems that may take the database offline or shutdown the instance. Is not technically possible to raise errors with severity above 25, your example with severity 100 is just silliness.

这篇关于存放在C#中的SqlServer的RAISERROR消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆