Visual Studio Error R6034 when using Transaction Scope with File S

G

Guest

Very 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.ConnectionStrings­("mysqlConnString").ConnectionString)


Try


' Build a query to execute
sSQLCommand = "DELETE FROM Customers WHERE
CustomerID = '" &
Me.gvCustomers.SelectedRow.Cells(eCUSTOMERSCOLUMNS.CustomerID).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
 
J

Just Me

Well, the first thing that comes to mind here is validation.

You are deleting a directory and its contents based on what you think might
be in a record displayed in a gridview. This is dangerous. You need to
re-think your strategy here and think about what can go wrong if the data is
absent or mal formed or simply wrong in the displayed cell.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top