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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T10:44:07+00:00 2026-06-01T10:44:07+00:00

I have a Model created with a table called Customers. It contains the following

  • 0

I have a Model created with a table called “Customers”.

It contains the following fields:

  • CustomerProfileID
  • CustomerName
  • BirthDate
  • Address1
  • City
  • State
  • Zip
  • CreatedOn
  • CreatedBy

I did a “Function Import” of a Stored Procedure (CustomerProfiles_Search) that Searches the table. (I cannot post the Sproc due to sensitive information). The “Returns a Collection Of” is set to “Entities: CustomerProfile”. It returns the following:

  • CustomerName
  • BirthDate
  • Address1

Now here is where I get confused. I have my Controller that is passing in the fields to search by and then passes it into my “Gateway” which returns a list.

My Controller:

public ActionResult GetRowCount(string CustomerName, string BirthDate, string Address1, string City, string State, string Zip)
{
    List<CustomerProfile> searchResults = CustomerProfileGateway.Search(CustomerName, BirthDate, Address1, City, State, Zip);

    int count = searchResults.Count();
    string rowCount = count.ToString();

    if (Request.IsAjaxRequest())
        return Content(rowCount);
    else
        return RedirectToAction("Index", "OneView");
}

… Inside my CustomerProfileGateway.cs file:

public static List<CustomerProfile> Search(string CustomerName, string BirthDate, string Address1, string City, string State, int Zip)
{
    using (ModelEntities context = new ModelEntities())
    {
        return context.CustomerProfiles_Search(CustomerName, BirthDate, Address1, City, State, Zip).ToList();
    }
}

However, when I try to output the results to a List, I get an error when I do:

The data reader is incompatible with the specified 'SVPModel.CustomerProfile'. A member of the type, 'CustomerProfileID', does not have a corresponding column in the data reader with the same name.

I think I need to create a Model of what is returned.

I created the following:

namespace Project.ABC.Objects
{
    class SearchModel
    {
            public class SearchResults
            {
                public string CustomerName { get; set; }
                public string BirthDate { get; set; }
                public string Address1 { get; set; }
            }
    }
}

But I don’t know how to do this? Can someone please show me what I am doing wrong here. Any help is greatly 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-06-01T10:44:09+00:00Added an answer on June 1, 2026 at 10:44 am

    The problem is that your sproc is not returning all the columns you are requiring by saying that it should map to a CustomerProfile.

    When it tries to read the properties from the DataReader, it can’t find a column called CustomerProfileID, hence the message:

    A member of the type, ‘CustomerProfileID’, does not have a corresponding column in the data reader with the same name

    Your SearchResults looks good. You just have to set “Returns a Collection Of” to “Entities: SearchResults”

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

Sidebar

Related Questions

I have the old legacy table called DXFTACCTS, and I created Rails model Account.
I have created a simple state machine model in Enterprise Architect and exported it
I'm creating a model called Configuration and I have the following code and I
I have this in my table model called Table $test = $this->find('first', array( 'conditions'
I have created a model POCO class called Recipe ; a corresponding RecipeRepository persists
Let's say i have a database table called 'people'. 70% of the fields in
I have a model called TipoContato (table tipos_contato), if I pluralize this it will
I have a model called NoteCategory, which is functioning as a join table between
I have a Rails model called Person which has database table columns for first_name
I have a model with a datetime field: class MyModel(models.Model): created = models.DateTimeField(auto_now =

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.