0

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.

zanhtet
  • 2,040
  • 7
  • 33
  • 58

2 Answers2

0

You need to use a SELECT statement or a RETURN

Slappy
  • 4,042
  • 2
  • 29
  • 41
0

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.

Furqan Hameedi
  • 4,372
  • 3
  • 27
  • 34