Click here to Skip to main content
15,913,854 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How do you verify that LINQ SubmitChanges() worked for inserts and updates? The method doesn't return a bool or int value.
Posted
Updated 27-Jul-13 11:41am
v2
Comments
Jameel VM 26-Jul-13 10:28am    
put the code inside the try catch and check any exception comes
TryAndSucceed 26-Jul-13 12:05pm    
Check the count of rows for the DataGrid or DataRow you are submitting changes for.
Dholakiya Ankit 27-Jul-13 7:17am    
make int method if returns 0 then success if 1 then error
Drazen Pupovac 27-Jul-13 14:03pm    
You can use database profiler to see what is sent to database.

try catch is the best thing to check these things.
 
Share this answer
 
A good question, however, it looks like you will have to perform a manual check.

Note: SubmitChanges() starts a transaction and will roll back if an exception occurs while SubmitChanges is executing.
This does not, however, roll back the changes in memory or tracked by the DataContext; those changes will need to be rolled back manually.
 
Share this answer
 
you are using transaction for that one ?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900