开发者

I don't know how to get print message from store procedure

开发者 https://www.devze.com 2023-02-15 18:13 出处:网络
I wrote a store procedure. CREATE PROCEDURE [dbo开发者_运维问答].[Test] (@Num int) AS BEGIN IF @Num = 1

I wrote a store procedure.

CREATE PROCEDURE [dbo开发者_运维问答].[Test]
      (@Num int)
AS
BEGIN
    IF @Num = 1
       PRINT 'This is One';
    ELSE
       PRINT 'This is Another';
END

I implement in .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

I don't know how to get print message from store procedure Please, help me.


You need to use a SELECT statement or a RETURN


PRINT is used to print messages on console for debugging purposes, you cannot get it as an SP result, rather you should use OUTPUT variable for this.

0

精彩评论

暂无评论...
验证码 换一张
取 消