title: Return data from SQL Server using Stored Procedure
body: <p>I am having trouble returning data from my sql-server database to an aspx page using a stored procedure and was hoping somebody could highlight where I am going wrong.</p>
  
  <p>When I run the project data is successfully input into the table but nothing is returned on the following page (Confirm.aspx)</p>
  
  <p><strong>Confirm.aspx.cs</strong></p>
  
  <pre><code>using Devworks;
  
  namespace OSQARv0._1
  {
      public partial class Confirm_Questionnaire : System.Web.UI.Page
      {
          OscarSQL b;
  
          protected void Page_Load(object sender, EventArgs e)
          {
              b = new OscarSQL();
              string qstname = b.GetQuestionName();
              ReturnQstID.Text = qstname;          
  
          }// End Page_Load
  
      } // Emd Class Confirm_Questionnaire
  
  } // End Namespace
  </code></pre>
  
  <p><strong>SQL.cs (App Code)</strong></p>
  
  <pre><code>public OscarSQL()
          {
              _productConn = new SqlConnection();
              _productConnectionString += "data source=mssql.database.co.uk; Initial Catalog=devworks_oscar;User ID=username;Password=password";
              _productConn.ConnectionString = _productConnectionString;
          }
      public string GetQuestionName()
              {
                  SqlCommand myCommand = new SqlCommand("GetQuestion", _productConn);
                  myCommand.CommandType = CommandType.StoredProcedure;
                  SqlParameter retval = myCommand.Parameters.Add("@QUESTTEXT", SqlDbType.VarChar);
                  retval.Direction = ParameterDirection.Output;
                  _productConn.Open();
                  string returnvalue = (string)myCommand.Parameters["@QUESTTEXT"].Value;
                  _productConn.Close();
                  return returnvalue;
              }
  </code></pre>
  
  <p><strong>Stored Procedure</strong></p>
  
  <pre><code>USE [devworks_oscar]
  GO
  
  SET ANSI_NULLS ON
  GO
  SET QUOTED_IDENTIFIER ON
  GO
  
  ALTER PROCEDURE [hgomez].[GetQuestion]  
  
  AS
      /*SET NOCOUNT ON;*/
      SELECT QuestionText FROM [Questions] WHERE QuestionnaireID = 21
      RETURN
  </code></pre>
  
  <p>Any help would be much appreciated.</p>