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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:09:12+00:00 2026-05-23T01:09:12+00:00

I display data from a (sql)view with information from several tables which I created

  • 0

I display data from a (sql)view with information from several tables which I created in MS SQL Server. The collected data is shown in a strongly typed view in an asp.net mvc3 site using entity framework.

When creating the edit page everything shows up as expected, it’s when i’m trying to save my modified details stuff wont work.

The page builds

Some code

Method to display the edit page

public ActionResult Edit(Guid id)
{
    return View(db.ViewIndividualAlls.Where(x => x.UserGuid == id).SingleOrDefault());
}

Method to receive the HttpPost

[HttpPost]
public ActionResult Edit(Guid id, ViewIndividualAll viewIndividualAll)
{
    // Ind confirmed in the debugger, it works!
    var ind = db.ViewIndividualAlls.Where(x => x.UserGuid == id).SingleOrDefault();
    //var ind = db.ViewIndividualAlls.Find(viewIndividualAll);
    try
    {
        if (TryUpdateModel(ind))
        {
            db.SaveChanges();
            return RedirectToAction("Index");
        }
        else
        {
            ViewData["error"] = "Model validation failed!";
            return View(viewIndividualAll);
        } 
    }
    catch (Exception e)
    {
        ViewData["error"] = string.Concat(e.Message, " ", e.StackTrace);
        return View(viewIndividualAll);
    }
}

Error message

The property 'whatever' is part of the object's key information and cannot be modified.

Kind of strange since I’m able to update pretty much anything in sql server management studio, except stuff that’s bound with foreign keys of course.

Any advices (related) at all would be appreciated

Thanks!

Update

I checked the primary keys in the model browser and noticed they where all wrongly set so I fixed it. Now when I fixed that I get this new error

Unable to update the EntitySet 'ViewIndividualAll' because it has a DefiningQuery 
and no <UpdateFunction> element exists in the <ModificationFunctionMapping> 
element to support the current operation.

So no joy, more fixing, but still interested in help!

  • 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-23T01:09:12+00:00Added an answer on May 23, 2026 at 1:09 am

    Solved

    [HttpPost]
    public ActionResult Edit(Guid id, ViewIndividualAll viewIndividualAll)
    {
        var ind = db.ViewIndividualAlls.Find(id);
        try
        {
            if (TryUpdateModel(ind))
            {
                db.SaveChanges();
                return RedirectToAction("Index");
            }
            else
            {
                ViewData["error"] = "Model validation failed!";
                return View(viewIndividualAll);
            } 
        }
        catch (Exception e)
        {
            ViewData["error"] = string.Concat(e.Message, " ", e.StackTrace, "\n", e.InnerException, "\n", e.HelpLink);
            return View(viewIndividualAll);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Many applications have grids that display data from a database table one page at
I'm trying to get ReportViewer to display data from a BindingSource (VB.Net Winforms). I
I'm using the Repeater control on my site to display data from the database.
I want to display tabular type data, but it will not be coming from
C# Which Event should I use to display data in a textbox when I
I am trying to access information from an Oracle meta-data table from within a
Hey guys, I have an application that I want to display some data from
I am selecting the following data from an SQL database table in my controller
Let's say you have a form with a component that displays data from a
I display data into an html table, w/ a drop down box with a

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.