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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:54:39+00:00 2026-05-25T12:54:39+00:00

What I want to do is append to a record’s note column. What I

  • 0

What I want to do is append to a record’s note column.

What I do not want to do is fetch the whole record, which is very significant.

Here’s code that does not work:

string AppendNote(int key, string note)
{
    using (MyEntities _Context = new MyEntities())
    {
        var _Record = _Context.Records
            .Where(x => x.Id == key)
            .Select(x => new Record { Id = x.Id, Notes = x.Notes })
            .First();
        _Record.Notes += note;
        _Context.SaveChanges();
    }
}

What is the correct way?

I realize it is very similar to this VERY OLD question: Update statement with Entity Framework and this similar but ultimately dissimilar question: How to update a record without selecting that record again in ADO.NET Entity Framework? but, still, it seems there has to be a way.

  • 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-25T12:54:40+00:00Added an answer on May 25, 2026 at 12:54 pm

    As for simple minimal updates in EF, you can do them by attaching an object to the context like this:

    string AppendNote(int key, string note)
    {
        using (MyEntities _Context = new MyEntities())
        {
            var _Record = new Record { Id = key };
            _Context.Entry(_Record).State = System.Data.EntityState.Unchanged;
            _Record.Notes = note; //a simple update
            _Context.SaveChanges();
        }
    }
    

    However, you want to append to a current value. The code below is a bit messy because of the anonymously typed variable _R but it should fetch just the Notes column and append to it:

    string AppendNote(int key, string note)
    {
        using (MyEntities _Context = new MyEntities())
        {
            var _R = _Context.Records
                .Select(x=>new {Id = x.Id, Notes=x.Notes})
                .Where(x=>x.Id == key)
                .First();
            var _Record = new Record { Id = _R.Id, Notes=_R.Notes };
            _Context.Entry(_Record).State = System.Data.EntityState.Unchanged;
            _Record.Notes+= note;
            _Context.SaveChanges();
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to append a record in a TClientDataSet based on another record (in
I have a binary file to which I want to append a chunk of
I want to modify GDLC MP4 Muxer so that it will not send data
I want to append some nodes to an xml document using Linq2XML. The file
I want to append a <br /> to a particular class. Using the :after
I want to .append to a div and pass the value on as html
I have an unordered list with elements and I want to append an item
In my application, I want to append cells to the current tableview and have
I am working on a utility. I want to append data at the top
I have a list like: list = [[1,2,3],[4,5,6],[7,8,9]] I want to append a number

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.