SqlCommand cmd=new SqlCommand();
cmd.Connection=this.conn ;
cmd.CommandType=CommandType.StoredProcedure;
cmd.CommandText="Returnrowcount";
cmd.Parameters.Add(new SqlParameter("@sql",SqlDbType.VarChar,50));
cmd.Parameters["@sql"].Value=QueryString;
cmd.Parameters.Add(new SqlParameter("@rowscnt",SqlDbType.Int,4));
cmd.Parameters["@rowscnt"].Direction=ParameterDirection.Output;
cmd.ExecuteNonQuery();
int rowcount=Convert.ToInt32(cmd.Parameters["@rowscnt"].Value);
=============================
specify the parameter first:
SqlParameter sampParm = cmd.Parameters.Add("RETURN_VALUE", SqlDbType.Int);
sampParm.Direction = ParameterDirection.ReturnValue;
....
then, to get its value, use
cmd.Parameters["RETURN_VALUE"].Value