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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T16:56:55+00:00 2026-05-17T16:56:55+00:00

My WPF desktop-based application uses ADO.Net Entity Framework in order to connect to SQL

  • 0

My WPF desktop-based application uses ADO.Net Entity Framework in order to connect to SQL Server database. In one of the windows I have a DataGrid with all data from tbl_users, when user selects one of the rows (records) and clicks on Edit, application opens a new window with form, that includes all data that user can edit/update.

How to save changes (update/edit) of one of the table’s values to database via ADO.NET Entity Framework?

Here are some code snippets that help understand a situation:

1 – Edit window constructor

public object objToBeEdited;

public WinWorkers_EditWorker(tbl_users userToBeEdited){
    this.Title = Glidus.Properties.Resources.WinWorkers_EditWorker_WinName + Glidus.Properties.Resources.WinApp_WinName;
}

2 – Method Update, that doesn’t work

//assume inputted values to new object
tbl_users newUser = new tbl_users() {
    userName = this.WinWorkers_AddEditWorkers_Form_UserName.Text,
    userPassword = this.WinWorkers_AddEditWorkers_Form_Password.Text,
    userAccessLevel = this.WinWorkers_AddEditWorkers_Form_UserAccessLevel.Text
};

//default minimal password length is 4
if (App.IsInputValueMinLenOK(newUser.userPassword, 4)) {

    EntityKey key = App.glidusContext.CreateEntityKey("tbl_users", objToBeEdited);

    if (App.glidusContext.TryGetObjectByKey(key, out objToBeEdited)) {
        App.glidusContext.ApplyCurrentValues<tbl_users>(key.EntitySetName, newUser);
    }

    try {
        App.glidusContext.SaveChanges();
    }
    catch (Exception ex) {
        App.UnitedHandleException(ex);
    }
}

Please, help me, how to implement update ADO.NET record from the database. For example, in my table there is James Bond 007, after editing page (clicking in submit page) I see Austin Powers 008.

  • 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-17T16:56:55+00:00Added an answer on May 17, 2026 at 4:56 pm

    To edit or update you can use stub entities

    Category category = new Category { ID = 5};
    Context.AttachTo(“Categories”,category);
    
    Product product = new Product {
         Name = “Bovril”,
         Category = category
    };
    Context.AddToProducts(product);
    Context.SaveChanges();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I develop desktop-based WPF-application, that uses SQL Server 2008 R2 Database and ADO.NET Entity
In my desktop-based WPF-application I want to implement a toolbar with key actions (add,
I am writing a fairly simple WPF desktop application and under build\configuration manager, release
I've created a simple desktop application in C# 3.0 to learn some C#, wpf
I created a small WPF desktop application. I am thinking about how to make
I'm creating a WPF (in c#) application that will create html files based on
We have a WPF Application that runs from both desktop and as a XBAP
I am working on converting a web application over to a WPF desktop application.
WPF, Browserlike app. I got one page containing a ListView. After calling a PageFunction
Learning WPF nowadays. Found something new today with .Net dependency properties. What they bring

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.