Stored procedures 我不知道';我不知道如何从存储过程中获取打印消息

Stored procedures 我不知道';我不知道如何从存储过程中获取打印消息,stored-procedures,Stored Procedures,我写了一个存储过程 CREATE PROCEDURE [dbo].[Test] (@Num int) AS BEGIN IF @Num = 1 PRINT 'This is One'; ELSE PRINT 'This is Another'; END 我在.net中实现 Dim SqlCmd as new sqlcommand DIm SqlCon as new sqlconnection sqlcon.connectionstrin

我写了一个存储过程

CREATE PROCEDURE [dbo].[Test]
      (@Num int)
AS
BEGIN
    IF @Num = 1
       PRINT 'This is One';
    ELSE
       PRINT 'This is Another';
END
我在.net中实现

Dim SqlCmd as new sqlcommand
DIm SqlCon as new sqlconnection

sqlcon.connectionstring =""
sqlCmd.connection =con
sqlcon.open()
sqlcmd.commandtext ="Test"
Sqlcmd.commandtype = commandtype.storeprocedure
我不知道如何从存储过程中获取打印消息
请帮帮我。

您需要使用SELECT语句或RETURN语句。

出于调试目的,打印用于在控制台上打印消息,您无法将其作为SP结果,而应该使用输出变量进行此操作。

可能的重复。