Visual Studio Error R6034 when using Transaction Scope with File S

Discussion in 'ASP .Net' started by =?Utf-8?B?Sm9l?=, Sep 29, 2007.

  1. 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
    =?Utf-8?B?Sm9l?=, Sep 29, 2007
    #1
    1. Advertising

  2. =?Utf-8?B?Sm9l?=

    Just Me Guest

    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.





    "Joe" <> wrote in message
    news:D...
    > 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, Sep 29, 2007
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. wh
    Replies:
    2
    Views:
    504
    Cowboy \(Gregory A. Beamer\)
    Jan 16, 2004
  2. Thirumalai
    Replies:
    0
    Views:
    647
    Thirumalai
    May 22, 2006
  3. Esmail
    Replies:
    0
    Views:
    287
    Esmail
    Mar 21, 2009
  4. Esmail
    Replies:
    0
    Views:
    412
    Esmail
    Mar 24, 2009
  5. Vencz Istv?n
    Replies:
    2
    Views:
    283
Loading...

Share This Page