If you are trying to return a variable from your Stored Procedure, then you must declare an output variable. A sample Procedure is shown below.
You can then get the variable in your aspx page accordingly. Dont forget to handle null.
CREATE PROCEDURE [dbo].[sample]
@input varchar,
@output varchar OutPUT
AS
SET NOCOUNT ON
BEGIN
IF @input = 1
BEGIN
SET @output ='your message'
END
END
OR
If you were referring to print an error message from the SQL stored Proc , then use RAISEERROR function in your SQL Procedure.
use link
http://msdn.microsoft.com/en-us/library/ms178592.aspx[
^]
You can then catch the exception in the aspx page and display it as required.