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
24
votes
2 answers

LINQ not updating on .SubmitChanges()

Is there any reason something like this would not work? This is the logic I have used many times to update a record in a table with LINQ: DataClasses1DataContext db = new DataClasses1DataContext(); User updateUser = db.Users.Single(e => e.user ==…
ctrlShiftBryan
  • 24,340
  • 25
  • 68
  • 77
19
votes
4 answers

Row not found or changed LINQ C# error on simple statement

First of all, there is no chance that this is a multi-user issue, as I'm working locally on a dev version of the database. I am getting the not very explanatory Row not found or changed error being thrown when I perform db.SubmitChanges(). If I…
Greg
  • 19,156
  • 15
  • 75
  • 100
16
votes
7 answers

How to get the TSQL Query from LINQ DataContext.SubmitChanges()

I'm using Linq to SQL. I have a DataContext against which I am .SubmitChanges()'ing. There is an error inserting the identity field, and I'd like to see the query it's using to insert this identity field. I don't see the query itself within the…
tsilb
  • 7,534
  • 13
  • 64
  • 94
16
votes
2 answers

Exceptions by DataContext

I've been doing some searching on the internet, but I can't seem to find the awnser. What exceptions can a DataContext throw? Or to be more specific, what exceptions does the DataContext.SubmitChanges() method throw? EDIT For reference, here a List…
Bas
  • 1,222
  • 1
  • 11
  • 26
9
votes
1 answer

LINQ problems with NText, Text and Image on SQL server

Apologies up front, because this isn't a question but a solution - but it took a lot of searching to find out the answer and google wasn't much help, so I wanted to give something back to the community by providing the error and the solution to help…
Alex White
  • 1,360
  • 15
  • 22
6
votes
3 answers

ASP.NET Form - The form name\id changes to aspnetForm

I have this code:
That when i try to execute the code i get this instead:
natiz
  • 543
  • 1
  • 12
  • 29
6
votes
1 answer

WP8 & Linq to SQL with One-to-Many relation: SubmitChanges() removes wrong entity

I have the following entites/tables: Board: One board can have many pins Pin: One pin is assigned to one board. This entity is abstract and does have childs with different implementations. All childs belonging to the parent pin entity with…
zrkl
  • 827
  • 12
  • 41
6
votes
3 answers

Mimicking SQL Insert Trigger with LINQ-to-SQL

Using LINQ-to-SQL, I would like to automatically create child records when inserting the parent entity. Basically, mimicking how an SQL Insert trigger would work, but in-code so that some additional processing can be done. The parent has an…
BrandonB
  • 113
  • 1
  • 7
4
votes
1 answer

LINQ to SQL SubmitChangess() progress

I'm using LINQ to SQLto import old DBF files into MSSQL. I'm reading all rows and adding them to database using ctx.MyTable.InsertOnSubmit(row) After reading phase is completed I have around 100 000 pending inserts. ctx.SubmitChanges() naturally is…
Emir
  • 1,586
  • 2
  • 16
  • 32
4
votes
2 answers

LINQ to SQL context.SubmitChanges - How to get error details?

I'm working on an application where a lot of data is inserted into an SQL database at once. I use LINQ to SQL, and have something like this as my insert operation: foreach (var obj in objects) { …
Hallgeir
  • 1,083
  • 1
  • 12
  • 25
4
votes
1 answer

Inspection of Insert Statement When Using LINQ's SubmitChanges

I want to see what my insert statement would look like as if I was wiring up an text-based ADO.NET command. How do I do this? I have been following the below…
Peter
  • 4,933
  • 14
  • 55
  • 97
4
votes
1 answer

SubmitChanges internally adds all the fields as where clause, how to get rid of it

I have a table in database with a primary key say emp_pk. Now using LINQ I am trying to perform some operations on it. When I change few properties and call, context.SubmitChanges(); ideally the where clause should contain where emp_pk =…
Vijay Balkawade
  • 3,574
  • 12
  • 49
  • 87
3
votes
2 answers

LinQ DataContext - The operation cannot be performed during a call to SubmitChanges

The code which is throwing exception is extremely easy - this is very regular insert and then submit changes statement which looks: context.tb_dayErrorLog.InsertOnSubmit(data); context.SubmitChanges(); So really nothing special. This statement is…
Johnny
  • 385
  • 2
  • 14
3
votes
2 answers

Using SubmitChanges to create a LINQ Transaction

So, I'm trying to make a transaction with LINQ to SQL. I read that if I use SubmitChanges(), it would create a transaction and execute everything and in case of an exception everything would be rolled back. Do I need to use MULTIPLE SubmitChanges()?…
Vitor Reis
  • 979
  • 4
  • 23
  • 45
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
  • 176,854
  • 291
  • 683
  • 1,015
1
2 3 4 5 6 7