Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

After I delete an entity related to another record, this error occurs due to reference integrity:

"The statement DELETE in in conflict with the constraint...etc"

I manage this error with this code:

    Using transazione As ITransaction = sessione.BeginTransaction
        Try
            sessione.Delete(entity)
            transazione.Commit()
            Return True
        Catch ex As Exception
            transazione.Rollback()
            Return False
        End Try
    End Using

After this error, if I try to perform an UPDATE statement, it occours again the same error, even if I would no longer perform the DELETE statement.

Someone can help me to understand where I'm wrong? Thank's

share|improve this question

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.