I have a stored procedure which I can't modify and I'm trying to get the PRINT
message that get's returned if an error occurs. The code in my stored procedure is.
IF((ISNULL(@ID,''))='')
BEGIN
PRINT N'Error: This ID is invalid.';
RETURN;
END
In my dapper call, I have the following:
var storedProcResult = connection.Query("AdventureWorks.dbo.myStoredProcedure", new
{
@ID = null
},
commandType: CommandType.StoredProcedure
);
The value of storedProcResult
is 0
but I'm interested getting the PRINT
message. Please advise.