Questions tagged [insertonsubmit]
37 questions
0
votes
4 answers
LINQ to SQL: Read entity while calling "SubmitChanges" causes DuplicateKeyException
I'm experiencing a strange behavior that I really don't know how to work around it. I'm trying to read an entity just after it has been inserted (right after the ExecuteDynamicInsert) and when the partial method returns, I always get a…

Dany Leblanc
- 1
- 1
0
votes
1 answer
LINQ saying invalid arguments for insertonsubmit
I seem to be running into this issue with inserting data into a table in a SQL Server 08R2 using LINQ in C#. No matter what I've tried I keep getting an error with INSERTONSUBMIT().
Here is the code...
private void testUpdateUNITBC()
{
using…

saturnnine
- 1
- 2
0
votes
1 answer
Linq DataContext InsertOnSubmit statement Inserts only NULL values in the table
Please help!!!
I have this simple piece of code, I don't have a clue why is not doing what is supposed to do which is insert the data contained in the class, I have not idea what am I doing wrong, cause the insert statement produces only NULL values…

Josue Medrano
- 35
- 1
- 14
0
votes
3 answers
How do I get Id of a record without submitting and re-querying?
I have an ID that is set to auto increment (int obviously).
var dc = new DataContext([STRING]);
var usersTable = dc.GetTable();
var user = usersTable.FirstOrDefault(o => o.Username.Equals("NAME"));
if (user == null)
{
user = new…
user1017882
0
votes
1 answer
issue with submitChanges() inserting unwanted records in linq
I am using LINQ to insert records in the database. I create these records and keep track of them using a List. Based on some logic, I delete some of the records by deleting from the List. (I am using the same DataContext object).
When I want to…

hIpPy
- 4,649
- 6
- 51
- 65
-1
votes
1 answer
InsertOnSubmit gives this error. How do I fix this?
InsertOnSubmit gives error "there is no argument given that corresponds to the required formal parameter 'entity' of table.InsertOnSubmit(chalet)". How do I fix this?
This is my code.
public partial class MainWindow : Window
{
…

Jop Rill
- 65
- 8
-1
votes
1 answer
OnSubmit With validate and CheckCheckBox
I'm wanting to use on submit to make sure a checkbox is checked, while also validating empty fields.
Here is the code I have:
OnSubmit="return checkCheckBox(Agree) & validate();">
I've looked at W3Schools, and on Google, yet can't find what I'm…