Questions tagged [submitchanges]

Computes the set of modified objects to be inserted, updated, or deleted, and executes the appropriate commands to implement the changes to the database.

Computes the set of modified objects to be inserted, updated, or deleted, and executes the appropriate commands to implement the changes to the database.

Read more in: DataContext.SubmitChanges Method.

103 questions
3
votes
4 answers

What could be causing db.SubmitChanges() to not work in linq-to-sql?

I've set up a very simple example with LINQ-TO-SQL in WPF. I can get an object (pageItem) out like this and I can change the property and when I call SubmitChanges() it gives me no error but it doesn't save the change. MainDataContext db = new…
Edward Tanguay
  • 189,012
  • 314
  • 712
  • 1,047
3
votes
1 answer

LINQ DataContext.SubmitChanges() in C# Reporting "Object reference not set to an instance of an object."

I think a lot of people have had this issue but I'm not able to fix it or understand why I'm having it. I've been tearing hair out for a couple of hours now. I'm getting the error, "Object reference not set to an instance of an object." on my…
vealer
  • 625
  • 5
  • 9
2
votes
4 answers

LINQ: SubmitChanges() not updating my record

Not to sound like a broken record here (there a few posts that look like this one) but none of them seem to solve my problem. It seems that when you want to update private bool resetPassword(string password) { try { var db = new…
aarona
  • 35,986
  • 41
  • 138
  • 186
2
votes
1 answer

DLINQ- Entities being inserted without .InsertOnSubmit(...)?

I ran into an interesting problem while using DLINQ. When I instantiate an entity, calling .SubmitChanges() on the DataContext will insert a new row into the database - without having ever called .Insert[All]OnSubmit(...). //Code…
Charles
  • 6,199
  • 6
  • 50
  • 66
2
votes
4 answers

How often to call DataContext.SubmitChanges() for a large number of inserts?

How many InsertOnSubmit should I call before calling SubmitChanges? I'm adding data from a web service that can return tens of thousands of records one record at a time. The wrapper class around the web service exposes the records a an IEnumberable…
Ed Power
  • 8,310
  • 3
  • 36
  • 42
2
votes
1 answer

Several SubmitChanges in succession very slow

One question: Why when I use following code for (int i = 0; i < 10000; i++) { Entity e = new Entity(); e.DisplayValue = i.ToString(); ctx.Entities.InsertOnSubmit(e); } ctx.SubmitChanges(); it finishes after about 8 seconds…
user358317
  • 21
  • 1
1
vote
1 answer

LINQ to SQL SubmitChanges() not work to insert new record

First, I'm pretty new to LINQ to SQL, so this is probably a dumb question, but I'm trying to insert a new record into the database and I keep getting the following error: The client was unable to establish a connection because of an error during…
Cory
  • 658
  • 3
  • 7
  • 19
1
vote
1 answer

SubmitChanges with LINQ to SQL and User Defined Functions

On the SQL server I create a UDF. Let's name it fnCompanyDetails. It selects some information about a company from several joint tables. I then drag-and-drop this function in the new .dbml of my VB project. I want to use it with LINQ. Smth like…
kzub
  • 232
  • 3
  • 13
1
vote
1 answer

An attempt has been made to Attach or Add an entity that is not new, perhaps having been loaded from another DataContext. This is not supported

My project is divided to PresentationLayer, BusinesLogicLayer and DataAccessLayer. Every created object goes through these layers. In simplifying: SetFilter.xaml.cs FilterFactory fFactory = new FilterFactory(); Filter myFilter =…
Saint
  • 5,397
  • 22
  • 63
  • 107
1
vote
1 answer

SubmitChanges Get back record immediately

I have a form that adds a record to the database. The primary key is auto incremented. I would like to have the web page redirect to the page that displays the information that was just entered. For example, it would redirect to…
gberg927
  • 1,636
  • 9
  • 38
  • 51
1
vote
0 answers

How reset "new version" of app in appstore

I wonder if there is any way of "resetting" the "new version" of my app in the appStore. NO, doing a reject of the binary does not seem to be enough. The problem is the following: I have this app (found here: www.pekbok.com :) ) that has been poorly…
tommys
  • 865
  • 1
  • 11
  • 21
1
vote
1 answer

Using LINQ add CHILD VALUE always 1

I have the Tables PatientEligibilit and PatientsEligibilitiesDoctorsSpecialties and DoctorsSpecialties PatientEligibilit has foreign key PatientsEligibilitiesDoctorsSpecialtyID from…
MoniR
  • 1,351
  • 12
  • 18
1
vote
3 answers

linq submitchanges runs out of memory

I have a database with about 180,000 records. I'm trying to attach a pdf file to each of those records. Each pdf is about 250 kb in size. However, after about a minute my program starts taking about about a GB of memory and I have to stop it. I…
Leon
  • 15
  • 2
1
vote
0 answers

Linq to sql stop working

hey, I have strange problem, i've built a prject using the Linq, and most of it works fine, However sometimes all the Linq's Repository commands stop working, and i'm geeting errors, the issue solve when i overwrtie the existig dll files of the Linq…
Roy Amir
  • 457
  • 1
  • 6
  • 15
1
vote
1 answer

linq to sql continue error

i had an error on a linq query when i tried to do SubmitChanges() the problem is that what ever i try to do in my project now i'm getting the same error (i guess the linq still tring to do the Error Change) how can i clean the pendding changes or…
Roy Amir
  • 457
  • 1
  • 6
  • 15