TransactionScope Error

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • RP

    #1

    TransactionScope Error

    I tried following code but it generates error at line (using .....):

    Error 23 The type or namespace name 'TransactionSco pe' could
    not be
    found (are you missing a using directive or an assembly reference?)

    ===[CODE]=============== =============== ==========

    private void cmdProceed_Clic k(object sender, EventArgs e)
    {
    using (TransactionSco pe scope = new TransactionScop e())
    {
    GenerateAll();

    // Commit the transaction.
    scope.Complete( );
    }

    }
    =============== =============== =============== ====

  • Jon Skeet [C# MVP]

    #2
    Re: TransactionScop e Error

    On Oct 12, 8:15 am, RP <rpk.gene...@gm ail.comwrote:
    I tried following code but it generates error at line (using .....):
    >
    Error 23 The type or namespace name 'TransactionSco pe' could
    not be found (are you missing a using directive or an assembly reference?)
    Well, the error message is fairly clear: you're missing a using
    directive or assembly reference. TransactionScop e is in the
    System.Transact ions namespace, in the
    System.Transact ions.dll assembly.

    Jon

    Comment

    • RP

      #3
      Re: TransactionScop e Error

      When I type System. , I cannot see anything like Transactions. It
      does not appear in the list.


      On Oct 12, 12:21 pm, "Jon Skeet [C# MVP]" <sk...@pobox.co mwrote:
      On Oct 12, 8:15 am, RP <rpk.gene...@gm ail.comwrote:
      >
      I tried following code but it generates error at line (using .....):
      >
      Error 23 The type or namespace name 'TransactionSco pe' could
      not be found (are you missing a using directive or an assembly reference?)
      >
      Well, the error message is fairly clear: you're missing a using
      directive or assembly reference. TransactionScop e is in the
      System.Transact ions namespace, in the
      System.Transact ions.dll assembly.
      >
      Jon

      Comment

      • RP

        #4
        Re: TransactionScop e Error

        I also want to know how is TransactionScop e different from the old
        SQLTransaction. Secondly, while using TransactionScop e, how to
        determine whether the transaction was successful or not.

        Comment

        • Jon Skeet [C# MVP]

          #5
          Re: TransactionScop e Error

          On Oct 12, 8:32 am, RP <rpk.gene...@gm ail.comwrote:
          When I type System. , I cannot see anything like Transactions. It
          does not appear in the list.
          And that suggests that you haven't referenced the
          System.Transact ions.dll assembly.

          Jon

          Comment

          • Jon Skeet [C# MVP]

            #6
            Re: TransactionScop e Error

            On Oct 12, 8:41 am, RP <rpk.gene...@gm ail.comwrote:
            I also want to know how is TransactionScop e different from the old
            SQLTransaction.
            Well it's not tied to SQL Server, to start with... it's a more general
            transaction mechanism.
            Secondly, while using TransactionScop e, how to
            determine whether the transaction was successful or not.
            The docs aren't terribly clear, but it looks like you'll get a
            TransactionInDo ubtException if the commit fails.

            Jon

            Comment

            Working...