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

  • Home
  • SEARCH
  • 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 8969465
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:35:41+00:00 2026-06-15T17:35:41+00:00

I have a SQL stored procedure that returns a column value (SQL data type:

  • 0

I have a SQL stored procedure that returns a column value (SQL data type: nchar(1)). The stored procedure runs and comes back with desired value when a parameter is passed. Based on this returned value, I want to divert the program flow. For this I need to read the value returned in an ASP.NET C# variable, but I am not sure how can I do this.

create procedure sproc_Type
      @name as nchar(10)
AS    
SELECT Type FROM Table WHERE Name = @name

I want to read Type value in .cs file and want to save it for later use.

  • 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-06-15T17:35:42+00:00Added an answer on June 15, 2026 at 5:35 pm
                 SqlConnection conn = null;
                 SqlDataReader rdr  = null;
                 conn = new 
                    SqlConnection("Server=(local);DataBase=Northwind;Integrated Security=SSPI");
                conn.Open();
    
                // 1.  create a command object identifying
                //     the stored procedure
                SqlCommand cmd  = new SqlCommand(
                    "Stored_PROCEDURE_NAME", conn);
    
                // 2. set the command object so it knows
                //    to execute a stored procedure
                cmd.CommandType = CommandType.StoredProcedure;
    
                // 3. add parameter to command, which
                //    will be passed to the stored procedure
                cmd.Parameters.Add(
                    new SqlParameter("@PARAMETER_NAME", PARAMETER_VALUE));
    
                // execute the command
                rdr = cmd.ExecuteReader();
    
                // iterate through results, printing each to console
                while (rdr.Read())
                {
                    var result = rdr["COLUMN_NAME"].ToString();
                }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a stored procedure in SQL Server that returns some data via a
Let's say I have a stored procedure in Microsoft SQL Server 2005 that returns
I have a SQL Server stored procedure that is not returning any data when
I have a stored procedure that runs custom backups for around 60 SQL servers
I have an app that runs a stored procedure in SQL Server, checking the
Using Microsoft SQL Server. Running a stored procedure that returns 'No column name' as
I have written a SQL Server stored procedure that includes a DateTime parameter. This
I have a line in my SQL Stored Procedure that looks like this (works
I have a stored procedure that has this line: SET @SQL = 'SELECT path,title,tags
On our SQL Server (Version 10.0.1600), I have a stored procedure that I wrote.

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.