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
0
votes
1 answer

Unique key constraint error when updating a SQL Server table in ASP.NET application

I have a simple table with the following: ID MarketID Lead 1 1 true 2 1 false 3 2 true 4 2 false It is a table of paired values, so the pattern is that there are always two rows with the same MarketID, but one…
0
votes
0 answers

DataContext.SubmitChanges() throws NullReferenceException everytime I want to update connected database

As I said in the title of the topic, I have a problem with DataContext.SubmitChanges() method. I have two tables: Users and Administrators (and other roles as Doctors etc, but now I am working with these two tables). SQL scripts for those two…
0
votes
0 answers

oData Model submitChanges error callback function not executed

I would like to know when I use the submitChanges of sap.ui.model.odata.v2.ODataModel, and have a success and error callback function. Even if the request failed the success handler gets called. My code example is below: onSave: function() { …
Mishan L
  • 45
  • 1
  • 1
  • 5
0
votes
0 answers

Error : Cannot add an entity with a key that is already in use, when using ExecuteCommand

I deleted a record by using ExecuteCommand between Linq to SQL insertions as below. At the last call of SubmitChanges, I got below error : Cannot add an entity with a key that is already in use. If I use Linq to SQL for deleting, I get no problem,…
0
votes
1 answer

SubmitChanges Inserts new record for foreign relation instead of use the assigned one

I got the following Tables with valid relations as shown below: Report ------>ReprotDataSource --------->SharePointDomain Now, when i try the following ( link the newly ReprotDataSource to the Selected SharePointDomain) it…
Rami Alshareef
  • 7,015
  • 12
  • 47
  • 75
0
votes
3 answers

Erratic LINQ to SQL Error: "operation cannot be performed during a call to SubmitChanges."

Okay, so I'm getting this error from the lines: System.Data.Linq.DataContext.CheckNotInSubmitChanges() +42 System.Data.Linq.DataContext.SubmitChanges(ConflictMode failureMode) +54 What I'm doing is tracking an application's state and logging…
smartcaveman
  • 41,281
  • 29
  • 127
  • 212
0
votes
2 answers

LINQ to SQL SubmitChanges not working FILESTREAM Table

I have some code that inserts data into some tables (one table has a FILESTREAM column) and then calls SubmitChanges after it is done. db.Log = new System.IO.StreamWriter(@"c:\windows\temp\linq.log") { AutoFlush = true…
BabelFish
  • 899
  • 2
  • 9
  • 20
0
votes
1 answer

LINQ SubmitChanges with join doesnt work

I cannot get the data from adc to update to database. I am using LINQ2SQL dbml. I get no sql output from CAPcontext.Log, and Both tables have primary ID's I feel it is an issue with the join in the LINQ query but couldnt find anything on the web…
bradley32110
  • 53
  • 1
  • 9
0
votes
1 answer

SubmitChanges() throws internal server error

public void RejectOrder(string rejectReason, int selectedNewOrderId) { SFNewOrder sfNewOrder = mdbDataContext.SFNewOrders.FirstOrDefault(x => x.ID == selectedNewOrderId && !x.IsRejected); if (sfNewOrder != null) { …
Renascent
  • 184
  • 1
  • 3
  • 17
0
votes
1 answer

Linq to SQL InsertOnSubmit for multiple objects

I have a problem with Linq to SQL InsertOnSubmit, which only seems to work for the first item in a table. For example with the following: var noteDetail1 = new NoteDetail() { Title = "Test Note Title 1", NoteText = "Test note" }; var waiverDetail1 =…
Darren
  • 159
  • 11
0
votes
1 answer

c# linq discrad InsertOnSubmit

i have a problem while using SubmitChanges() and InsertOnSubmit(), if the SubmitChanges fail and raise an exception the change set remains filled with the object that have a conflict in the db (e.g. the primary key already exists). the problem is…
0
votes
0 answers

An exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.Linq.dll but was not handled in user code

protected void btnInsert_Click(object sender, EventArgs e) { if (Page.IsValid) { string Name = txtBookName.Text; string Author = txtAuthor.Text; string Publisher = txtPublisher.Text; …
0
votes
1 answer

Submitchanges after a loop - only last record saved

The following code works, but it only saves the last record in the loop, and I can't figure out why. I think the Submitchanges() is in the right place, at the end of the loop. Can someone please show me what's wrong? Thanks. Sub POPULATE_CHAIN() …
Zeus
  • 1,496
  • 2
  • 24
  • 53
0
votes
1 answer

Visual studio - IDENTITY_INSERT is set to OFF

I'm trying to add records to a local database using Visual Studio 2015 and linq to sql commands, but I get an error IDENTITY_INSERT is set to OFF. I'm not inserting a value for the primary key and Identity Specification is set to True. This is the…
Zeus
  • 1,496
  • 2
  • 24
  • 53
0
votes
2 answers

Get p:selectOneRadio value to a JS function

I have a PF's selectOneRadio to choose a file type to download. Also I have a commandButton to call a download servlet using onclick attribute. The problem is that when I choose file type and click the button, the chosen value is of course not yet…
peterremec
  • 488
  • 1
  • 15
  • 46