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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T21:34:09+00:00 2026-06-13T21:34:09+00:00

I am working on a migration project, where I am migrating an web forms

  • 0

I am working on a migration project, where I am migrating an web forms app to a ASP.NET MVC 4 app.

I have come across this one scenario with which I need a little help.

In the old web form project I have stored proc like…

ALTER PROCEDURE [dbo].[TestMultipleResultSet]
    @input VARCHAR
AS
BEGIN
    SET NOCOUNT ON;

    IF NOT EXISTS
    (
        SELECT * FROM Electronics
        WHERE name = @input
    )
    BEGIN
        SELECT 101 AS errorcode
        RETURN
    END

    SELECT * FROM Electronics 
    WHERE name = @input
END

like the above if not exist check, there are many other checks with gives different select * from as resultset.

Now I want to use Entity framework to execute this stored procedure, so I imported the function and created a complex type using the Get Column Information + Create Complex Type option which EF provides.

Now it runs when I enter a valid @input which executes SELECT * FROM Electronics WHERE name = @input but when I enter an input which is not present instead of returning me a 101 error code it gives me an error. An exception is thrown.

Exception details

The data reader is incompatible with the specified ‘testEFModel.GetTestResults_Result1’. A member of the type, ‘id’, does not have a corresponding column in the data reader with the same name.

How should I solve this ?

  • 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-13T21:34:10+00:00Added an answer on June 13, 2026 at 9:34 pm

    Is it really necessary that you use the stored procedure?

    Using EF you could simply do:

    var filteredItems = dc.Electronics.Where(e => e.Name == @input).ToList();
    
    if (!filteredItems.Any())
        throw new ApplicationException("No items were found according to criteria");
    

    Note: I have not actually run the above code; it just illustrates the idea doing things the EF way

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

recently, while working on a db2 -> oracle migration project, we came across this
So I'm working on this VB to C# web application migration and came across
I have recently been working on a ASP.NET project for a client. The project
I already have some simple project with one migration script: # --- !Ups create
Hopefully this is not a ServerFault question... I'm working forward on migrating a project
I'm working on migration of data from a legacy system into our new app(running
I'm working on database migration program and I'm trying to migrate one database to
I'm working on a blog migration from a custom built blog to Wordpress. One
I am working on a non Rails web app, so no migrations script by
I have been working on a project and gotten it through the first stage.

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.