| [SQLDownUnder] .net TransactionScope and Deferred Constraints |
- From: sql
- Subject: [SQLDownUnder] .net TransactionScope and Deferred Constraints
- Date: Sun, 03 Sep 2006 23:24:03 -0700
- Follow-Ups:
- Prev by Date: RE: [SQLDownUnder] Table Design
- Next by Date: RE: [SQLDownUnder] .net TransactionScope and Deferred Constraints
- Previous by thread: RE: [SQLDownUnder] Table Design
- Next by thread: RE: [SQLDownUnder] .net TransactionScope and Deferred Constraints
- Index(es):
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
|
Hello, I am wanting to create surveys with varying amount of
questions by inserting into two relations (this is a simplified version) Survey (SurveyID INT, SurveyName VARCHAR) SurveyQuestions (QuestionID INT, SurveyID INT,
QuestionText VAHRCHAR) I am trying to achieve this by using
TransactionScope. My code is looking something like this (c#): Using (TransactionScope scope = new TransactionScope) { Using (SqlCommand insertSurvey ….) { ….. insertSurvey.ExecuteNonQuery; } Using (SqlCommand insertQuestion ….) { …. Foreach (SurveyQuestion
q in questions) { …. insertSurveyQuestion.ExecuteNonQuery;
*** } } scope.Commit(); } My problem is that when the code gets to *** I am
violating foreign key constraints. How can I set the transaction to defer the checking
of the constrains either in my ADO.net code or in my T-SQL kind regards,
|
(Click here for more information on the sqldownunder mailling list)
