Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6779021
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:20:08+00:00 2026-05-26T16:20:08+00:00

I am having trouble returning data from my sql-server database to an aspx page

  • 0

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.

When I run the project data is successfully input into the table but nothing is returned on the following page (Confirm.aspx)

Confirm.aspx.cs

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

SQL.cs (App 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;
            }

Stored Procedure

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

Any help would be much appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T16:20:08+00:00Added an answer on May 26, 2026 at 4:20 pm

    You aren’t executing the proc. You are setting it up, but not returning it.

    string returnvalue = (string)myCommand.ExecuteScalar();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having trouble returning data from my controller using an ajax post function. What
I'm having trouble creating this stored procedure on IBM Informix Dynamic Server Version 10.00.FC9
I am having some trouble returning matrix data from one method to the main
I'm having trouble bringing back data from my PHP file. I guess I don't
I'm having trouble running a complex query against our company LDAP server. I'm using
I am having trouble returning multiple entities (eager loading) using the Include() method. I
I'm having some trouble returning multiple values in this program that calculates min, max,
Im having trouble using a .NET COM in vb6, It compiles ok and I
I having trouble in dividing the HTML frames. I have been using the following
Im having trouble reading from a CSV file final String DELIMITER = ,; Scanner

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.