C Datagridview Edit Cell Update Database Entity

Active6 years ago

I have simple C# WPF application which gets the data from the database into WPF datagrid via an Entity Framework model. In direction from database to WPF DataGrid everything works fine.

I have a function to edit a cell in my dgv. And that is the problem. I can only edit one cell. DataGridView Cell Editing and Updating DB (C#). How to update database using DataGridView. How do I calculate someone's age in C#? Edit and update a row in datagridview using c# Hai, Iam developping a project in windows application in c#.I have the columns Items,Rate,Qty,Total in. To change the values of rate and qty.And also I want to calculate the Net amount after changing the values.How can i update this record to the database.Please help me. Insert or delete.

My problem is the opposite direction from datagrid to the database. I'd like to update the database after every cell update, so I work in CellEditEnding event.

The code below doesn't throw any exception but no WPF datagrid cell changes are saved into the database (DGISPRSDataView is my WPF datagrid)

Please can you tell me, where is the problem? What am I missing? How can I connect datagrid changes into data model and to database? Or is there any callback from server - as is in Silverlight case - (Entity model + DomainContext class)

Thanks a lot!

marc_s
602k136 gold badges1151 silver badges1288 bronze badges
VilemRousiVilemRousi
1,2903 gold badges18 silver badges31 bronze badges

1 Answer

Try loading your data to one of the DBSets inside the context.A context should have a DBSet for each class you want to maintain, and the grid should have one of them as it's datasource

In Programs & Features I have Adobe Flash Player 25 ActiveX 25.0.0.148 and Adobe Flash Player 25 NPAPI 25.0.0.127 installed. Similar help and support threads Thread Forum Hi Folks, my main browser is Google Chrome. Descargar adobe flash player 10 activex gratis para windows 7. I also occasionally use IE & Firefox Portable. Do I need them both to be up to date or can I remove what I don't need.

For example when loading

When saving

Kirsten Greed

C Datagridview Edit Cell Update Database Entity Framework

Kirsten Greed
3,8367 gold badges71 silver badges141 bronze badges
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.

C Datagridview Edit Cell Update Database Entity List

Not the answer you're looking for? Browse other questions tagged c#wpfentity-frameworkwpfdatagridado.net-entity-data-model or ask your own question.