Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / September 2007

Tip: Looking for answers? Try searching our database.

Visual Studio Error R6034 when using Transaction Scope with File S

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Joe - 29 Sep 2007 19:57 GMT
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
Just Me - 29 Sep 2007 20:41 GMT
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.

> 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
[quoted text clipped - 83 lines]
> Thanks in advance,
> Joe

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.