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.
精彩评论