Questions tagged [savechanges]

DbContext.SaveChanges method in an Entity Framework method that saves all changes made in a context to the underlying database.

DbContext.SaveChanges method is Entity Framework method that saves all changes made in a context to the underlying database. More info: https://msdn.microsoft.com/en-us/library/system.data.entity.dbcontext.savechanges%28v=vs.113%29.aspx

421 questions
0
votes
0 answers

Add not inserting/working

I have an AccountRegister model that i make into an Account model and then add that Account model to the database. There is zero errors/exceptions when i click the create button, it just redirects to index as if it has inserted into the database,…
DrexxDK
  • 16
  • 3
0
votes
1 answer

Why my "Save" button doesn't work?

I have one of the biggest problem in my program. I've created Save button, but it saves if the .txt file is new (Then that button does "SaveAs" function). But when I open file, then type something and trying to save and it's not saving :S. Can…
0
votes
1 answer

Using VB.Net Read from file, edt cells and finally save

Public Function SetInfo(ByRef place As String, ByRef name As String) As Boolean Dim Completed As Boolean = False Dim MyExcel As New Excel.Application Dim myworkbook As New Excel.Workbook myworkbook =…
Penguini
  • 11
  • 3
0
votes
1 answer

MVC inserting multiple records instead of expected one

Let's say I have two models: public class User { [Key] public int UserId { get; set; } public string Name { get; set; } } and public class Friend { [Key] public int FriendId { get; set; } public User A { get; set; } …
0
votes
1 answer

Entity Framework SaveChanges(): Value of primary key column not being sent in

I just started experimenting with Entity Framework. I have created a table like so: CREATE TABLE WORK_EFFORT ( K__ID BIGINT, NAME NTEXT, DESCRIPTION NTEXT ) I also set K__ID to be the primary key. Back in my business tier, when I run…
0
votes
1 answer

breeze savechanges continues even if debug stop is clicked

I am testing a user-defined override to BeforeSaveEntities on the Breeze Server Side. I have a breakpoint where I am observing the saveMap, and I call a method on the sub-class of the EFContextProvider to loop through each entity being saved. …
user2197022
  • 235
  • 1
  • 2
  • 5
0
votes
1 answer

Entity Framework - Change field value after adding record?

I have a Customer table that I'm inserting records into via Entity Framework. The table has an integer primary key (custid). Before adding the Customer record to the context, I'm querying the database to get the last key used, then setting custid…
JoeMjr2
  • 3,804
  • 4
  • 34
  • 62
0
votes
1 answer

loop to save clients and contacts ado.net entity model

'm saving customers this way: tb_clientes tb = new tb_clientes(); tb.clienteNOME = Cliente.clienteNOME; tb.clienteCNPJ = Cliente.clienteCNPJ; tb.clienteIE = Cliente.clienteIE; tb.clienteENDERECO = Cliente.clienteENDERECO; tb.clienteNUMERO =…
mauriciosouza
  • 41
  • 1
  • 1
  • 5
0
votes
1 answer

save MATLAB code file along with results in one folder?

I'm processing a data set and running into a problem - although I xlswrite all the relevant output variables to a big Excel file that is timestamped, I don't save the code that actually generated that result. So if I try to recreate a certain set…
dustynrobots
  • 311
  • 4
  • 8
  • 20
0
votes
1 answer

Breeze SaveChanges

I am new to BreezeJS, and have recently created a project that is up and running. I am able to use Breeze to query data from my SQL server without a problem. However, whenever I try to save changes, the changes do not save. I have verified, in VS…
Bob Leavell
  • 3
  • 1
  • 2
0
votes
2 answers

EF 5 not saving changes on calling save changes

I am using EF 5 in VS 2012. I am trying to save a new record to a table but is not getting saved in the table and also no error is thrown. Please help . I am attaching my code. using (TestEntities context = new TestEntities(new…
Navneet Duggal
  • 91
  • 1
  • 15
0
votes
1 answer

Insertion multiple records in the same objectContext

I'm having some trouble when I try to insert data using the same objectContext. My problem is, the order that the Entity read my code is not the order that I "Add" it. Example: EntityAB has EntityA's PK as a FK. 1-N…
Michel Ayres
  • 5,891
  • 10
  • 63
  • 97
0
votes
0 answers

savechanges() saving one entity and not other

A weird situation has struck me this code was running successfully two days back, but i dont know why its not running as before now : public static void ChangeStatus(int sessionID, int? participantID, Guid? temporaryParticipantID, int…
tariq
  • 2,193
  • 15
  • 26
0
votes
2 answers

Entity framework savechanges() not working EF5, .Net4

I have the following code to update some inventory values... private static void UpdateInventory(int prodId, int qty) { using (var context = new uStore7_1Entities()) { //Get the catalogNo and ProductUnitID of the…
Bryce Martin
  • 129
  • 3
  • 17
0
votes
1 answer

Are EF data changes ONLY persisted when SaveChanges() is called?

I'm adding a "WhatIf" switch (inspired by the Powershell -WhatIf switch) to my app, that just simulates data processing, without persisting any actual data changes back to the EF storage. The way I hoped to implement this is simply by adding a check…
dark_perfect
  • 1,458
  • 1
  • 23
  • 41