March 24, 2012 at 7:07 pm
Hi,
My Linq is submitting the below query (I got the query from Profiler). But data is not inserted in the table.
If i run the same query in SQL Management Studio...it is inserting.
What might be the reason??
Please let me know.
---
exec sp_executesql N'insert [dbo].[Applicants]([ApplicantName], [NumberOfReferences], [RequestID], [Education], [HireApproved])
values (@0, @1, @2, @3, null)
select [ApplicationID]
from [dbo].[Applicants]
where @@ROWCOUNT > 0 and [ApplicationID] = scope_identity()',N'@0 nvarchar(50),@1 int,@2 uniqueidentifier,@3 nvarchar(50)',@0=N'sri',@1=5,@2='A6FF1F05-E507-4CBD-BC51-E5A621B08BC1',@3=N'Masters'
Thanks & Regards,
March 25, 2012 at 6:38 am
Hmm, there might be plenty of reasons, but here are a couple to get you started:
> When you are submitting your Linq-to-SQL DataContext (through the SubmitChanges method), are you scoping the transaction (using TransactionScope), it could be that the DataContext is being rolled back in the application side through the TransactionScope.
> Any DML Triggers setup on that table which are scoped to the Linq-to-SQL execution context, and are manipulating the end result data on that table?
Cheers
/>L
-----------------
... Then again, I could be totally wrong! Check the answer.
Check out posting guidelines here for faster more precise answers[/url].
I believe in Codd
... and Thinknook is my Chamber of Understanding
March 26, 2012 at 8:47 am
@@ROWCOUNT refers to the number of rows affected by the immediately-previous SQL statement. If you have any activity (like a SET statement, or an IF clause) between the statement you are running, and the statement for which you THINK the @@ROWCOUNT value should apply, your results will not be what you expect.
March 26, 2012 at 8:55 am
Thank you, Grasshopper.
You are right. This sql statement is going from workflow transaction. I couldn't see the code of xamlx file to know where and why it is rolling back. It is just rolling back and response activity is throwing an exception "The transaction under which this method call was executing was asynchronously aborted."
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply