Returning varchar value from a stored procedure in c#

Hello Guys

But the code below in c# returns an Int value from the calling Stored procedure,

How do i get it to return varchar, If i change the value to varchar it gives me an error. My Stored Procedure is below it

SqlCommand command = new SqlCommand(“G”, con);
command.CommandType = CommandType.StoredProcedure;
command.CommandTimeout = 6000;

    con.Open();

    command.Parameters.Add(new SqlParameter("@return", SqlDbType.VarChar));
    command.Parameters.Add("@Return", [COLOR="Red"]SqlDbType.Int[/COLOR]).Direction = ParameterDirection.ReturnValue;

    command.Parameters[0].Value = myreturn;







    [COLOR="red"]int i =  command.ExecuteNonQuery();[/COLOR]

    string retunvalue = command.Parameters["@Return"].Value.ToString();

    con.Close();

STORED PROCEDURE

ALTER PROCEDURE [dbo].[G] (
@return varchar(max) OUTPUT )
AS
SELECT @return = ‘test’
return @return

Remove the ‘return @return’ from your stored procedure.

The reason you were getting that error is because the return statement can only be used to return an integer and sql is trying to convert the string ‘test’ to an int. See http://msdn.microsoft.com/en-us/library/ms174998(SQL.90).aspx

thanks Atirez
However, I got it sorted.

I have removed the return statement and left it as an ouput value, and changed my C# page to read

param.Direction = ParameterDirection.Output;

Its ok now.

Thanks