Re: C# transactions v SQL transactions

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Scott Allen (bitmask_at_[nospam)
Date: 09/23/04


Date: Thu, 23 Sep 2004 11:12:11 -0400

Hi mrp:

As other have commented, error handling in stored procs is very
difficult to do - it tends to clutter up the TSQL quite a bit and it's
terribly easy to overlook a problem. It's an approach I try to avoid.

SQL 2005 has some improvements, but that's not here, and if you are
concerened about portability at all its not an option.

--
Scott
http://www.OdeToCode.com
On Thu, 23 Sep 2004 06:44:40 -0700, Mike P
<mrp@telcoelectronics.co.uk> wrote:
>I've been using C# transactions for a while and had no problems with
>them.  Using try catch blocks I can trap basically all possible errors
>and rollback all necessary data.
>
>Over the last few days I've been trying to convert some of this code to
>SQL Server stored procedures, but it seems to lack many of the benefits
>of C# transactions - a lot of the errors don't seem to be trapped by the
>SQL error trapping (e.g. if I do an update on a row that doesn't exist,
>no rollback occurs and execution continues, if a table I am trying to
>access doesn't exist then the sproc crashes).
>
>Can anybody tell me what reasons there are for writing your transactions
>in stored procedures rather than your .NET code, as there don't seem to
>be any to me.
>
>
>Any assistance would be really appreciated.
>
>
>Cheers,
>
>Mike
>
>
>*** Sent via Developersdex http://www.developersdex.com ***
>Don't just participate in USENET...get rewarded for it!


Relevant Pages

  • Re: C# transactions v SQL transactions
    ... There are a number of reasons for this, ... maintainability (you can turn transactions on and off with the flick of a ... > SQL Server stored procedures, but it seems to lack many of the benefits ... > in stored procedures rather than your .NET code, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: ORDER BY in VIEW not working
    ... But stored procedures are a dead end - you can't refer to them in any ... anything further with it in SQL, and the client has to do everything. ... The .NET code for each section of the website has to request the entire ...
    (comp.databases.ms-sqlserver)
  • C# transactions v SQL transactions
    ... and rollback all necessary data. ... SQL Server stored procedures, but it seems to lack many of the benefits ... of C# transactions - a lot of the errors don't seem to be trapped by the ... in stored procedures rather than your .NET code, ...
    (microsoft.public.dotnet.languages.csharp)
  • .NET transactions v SQL transactions
    ... and rollback all necessary data. ... SQL Server stored procedures, but it seems to lack many of the benefits ... of C# transactions - a lot of the errors don't seem to be trapped by the ... in stored procedures rather than your .NET code, ...
    (microsoft.public.sqlserver.programming)
  • Re: C# transactions v SQL transactions
    ... and rollback all necessary data. ... SQL Server stored procedures, but it seems to lack many of the benefits ... of C# transactions - a lot of the errors don't seem to be trapped by the ... in stored procedures rather than your .NET code, ...
    (microsoft.public.dotnet.languages.csharp)