Exception Handling

May 26, 2016 at 8:28 PM
I'm using BulkInsert in my application to insert several tables that make up a single case in the database. I have wrap that in a Transactionscope and all works well except when there is a failure on one of the inserts. Everything rolls back which is great but the exception is always "The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION." This does not provide enough information back to the user, is there something I can do to get the actual message of why the transaction failed?
            try
            {
                using (var ctx = new x12EDI837I())
                {
                    using (var transactionScope = new TransactionScope())
                    {
                        // some stuff in dbcontext


                        ctx.BulkInsert(lTS837I_InterchangeEnvelope);
                        ctx.BulkInsert(lTS837I_FunctionGroupEnvelope);

                        ctx.BulkInsert(lTS837I_Area1);
                        ctx.BulkInsert(lTS837I_Nm11000A);
                        ctx.BulkInsert(lTS837I_Nm11000B);
                        ctx.BulkInsert(lTS837I_Nm1Per1000A);


                    transactionScope.Complete();
                }
            }

            }//try
            catch (Exception exception)
            {
                System.Windows.Forms.MessageBox.Show(exception.Message);
                return false;
            };