Throwing exception from class methods

Last post 03-02-2010 5:30 AM by dev8546. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 01-17-2010 2:49 PM

    Throwing exception from class methods

     Hi,

    I have 2 classes with some data insert methods, basicinfo and otherinfo. both methods named save and gets connection and transaction as parameters.

    now i need to call both methods in a try catch block with transaction and want to catch it. if some error occur in the methods the try catch block of the calling code should catch the execption. how can i achieve this.

    begin transaction

    try

    {

    basicinfo.save(trn,cnn)

    otherinfo.save(trn,cnn)

    trn.commit

    }

    catch

    {

    trn.rollback

    }

     

    thanks

  •  Advertisement

    Featured Advertisement

     
  • 02-06-2010 12:51 PM In reply to

    Re: Throwing exception from class methods

    Why you are not trying to handle Transaction in SP insted of .NET code ?

  • 03-02-2010 5:30 AM In reply to

    • dev8546
    • Not Ranked
    • Joined on 02-14-2010
    • Bangalore
    • Wannabe Slacker
    • Points 85

    Re: Throwing exception from class methods

    After trn.rollback , throw the exception by using throw key word

    Devesh Kumar
Page 1 of 1 (3 items)