sql server打印功能 [英] sql server Print function

查看:131
本文介绍了sql server打印功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要输出sql打印值,我正在传递一些值,如何获取该值的aspx页,任何人都可以帮助我,先生

推荐答案

如果您试图从存储过程中返回变量,则必须声明一个输出变量.下面显示了示例过程.
然后,您可以在aspx页面中相应地获取变量.不要忘记处理null.
If you are trying to return a variable from your Stored Procedure, then you must declare an output variable. A sample Procedure is shown below.
You can then get the variable in your aspx page accordingly. Dont forget to handle null.
CREATE PROCEDURE [dbo].[sample]
     @input varchar,
     @output varchar OutPUT
AS
SET NOCOUNT ON

BEGIN
  IF @input = 1  
   BEGIN
    SET @output ='your message'
   END
END




如果要从SQL存储的Proc中打印错误消息,请在SQL过程中使用RAISEERROR函数.
使用链接 http://msdn.microsoft.com/en-us/library/ms178592.aspx [ ^ ]

然后,您可以在aspx页面中捕获异常并根据需要显示它.


OR

If you were referring to print an error message from the SQL stored Proc , then use RAISEERROR function in your SQL Procedure.
use link http://msdn.microsoft.com/en-us/library/ms178592.aspx[^]

You can then catch the exception in the aspx page and display it as required.


这篇关于sql server打印功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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