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 8338959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:45:07+00:00 2026-06-09T04:45:07+00:00

I have created a stored procedure which will return a set of data. In

  • 0

I have created a stored procedure which will return a set of data. In my case it is set of roles

CREATE PROCEDURE [dbo].[GetRoles]
@ID Int
AS
SELECT Roles.Role FROM Roles WHERE Roles.CustomerCustomerID=@customerID
RETURN 0

I am using Entity Framework to get this value to a variable like this:

var query = context.GetRoles(ID);

I am planning to manipulate this dataset and create a list of “roles” and return the list

But since I am calling the stored procedure and I am not writing the query statement here
for example:

using (AdventureWorksEntities context = new AdventureWorksEntities())
{
    string LastName = "Zhou";
    var query = from contact in context.Contacts 
                where contact.LastName == LastName 
                select contact;

    // Iterate through the collection of Contact items.
    foreach( var result in query)
    {
        Console.WriteLine("Contact First Name: {0}; Last Name: {1}", 
                result.FirstName, result.LastName);
    }
}

How can I get the values that are in each result?

I can not obviously access the fields of the table in intellisense

What is the approach should I take on this issue?

Thanks In advance..

  • 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-09T04:45:10+00:00Added an answer on June 9, 2026 at 4:45 am

    You need to create a FunctionImport in your EDMX model, and map the columns to an entity or a complex type. To do this, right click in the EDMX, choose Add/Function Import, and select the Stored Procedure from the list (if not there, refresh the model from the database). Give the FunctionImport a name (eg: “GetRoles”) and choose what it returns (in your example, a collection of Scalars of whatever type Roles.Role is.

    Then

    var query = context.GetRoles(ID); 
    

    will return an ObjectSet<T>, where T is the type you have mapped it to, that you can iterate through.

    • 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 which looks like CREATE PROCEDURE Update-all ( @RowID INT,
I have a Stored Procedure which right now returns a (potentially) large data set.
I have just created a report in Report Manager using a Stored Procedure which
I have a stored procedure which returns a ref cursor as follows: CREATE OR
I have a stored procedure in which i want to create a user defined
I have a stored procedure :- CREATE procedure St_Proc_GetTimeEntryID @userID int, @timeEntryID int output
Okay basically I am creating a stored procedure that will return data for our
I have written a Stored Procedure as shown , which will be responsible to
i need to write a stored procedure which will return a string.logic is when
I have a stored Procedure (Generate_Insert)which will output an Insert statement as output given

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.