Visual Studio Error R6034 when using Transaction Scope with File S
am 29.09.2007 20:55:01 von joeVery weird; I lost a day worth of work because of this problem.
I have an ASP.NET application written in VB that is using MySQL
database. Shortly, a page creates a Customer record in the database
and if successful, creates a directory on the web server. I was using
Transaction Scope to accomplish this action; here is the code excerpt:
' Initialize the return value to zero
Dim returnValue As Integer = 0
' Create a command string
Dim sSQLCommand As String
Try
Using scope As New TransactionScope()
Using connection1 As New
MySqlConnection(System.Configuration.ConfigurationManager.Co nnectionStringsÂ("mysqlConnString").ConnectionString)
Try
' Build a query to execute
sSQLCommand = "DELETE FROM Customers WHERE
CustomerID = '" &
Me.gvCustomers.SelectedRow.Cells(eCUSTOMERSCOLUMNS.CustomerI D).Text &
"' "
' Opening the connection automatically
enlists it in the
' TransactionScope as a lightweight
transaction.
connection1.Open()
' Create the MySqlCommand object and
execute the first command.
Dim command1 As MySqlCommand = New
MySqlCommand(sSQLCommand, connection1)
returnValue = command1.ExecuteNonQuery()
' Delete directory
System.IO.Directory.Delete(Me.gvCustomers.SelectedRow.Cells( eCUSTOMERSCOLUMÂNS.DirectoryPhysicalPath).Text,
True)
Catch ex As Exception
' Log error here
Throw New Exception("Error", ex)
End Try
End Using
' Success, empty the session variables
Session("selectedcustomerid") = String.Empty
Session("selectedcustomername") = String.Empty
' The Complete method commits the transaction. If
an exception has been thrown,
' Complete is called and the transaction is rolled
back.
scope.Complete()
End Using
Catch ex As Exception
' Log error here
End Try
I have checked the grid value for the DELETE statement and both path
and CustomerID were correct.
And one more thing; my web project was located on the external hard
drive.
What happened here is that I end up in the first Catch block with the
timeout and then I stopped the application. Then I got a weird
manifest error and a message to close VS because it is in 'unstable
state'. After I restarted VS, I get Error R6034 and after research, I
saw that most of my C:\Program Files\Microsoft Visual Studio 8 is
gone!!!
And a day later, I am running it again after I had to reinstall both
Visual Studio 2005 and SQL Server 2005 that was also installed on my
machine.
Anybody experienced anything similar to this and does anybody (maybe
Microsoft folks) have a possible explanation for this issue?
Thanks in advance,
Joe