Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2002
    Posts
    46

    Unanswered: try and catch problem

    Hi,
    I have the following routine:
    Private void temp()
    {
    ResultSet _res = null;
    PreparedStatement _ps = null;
    try{
    some thing.......
    }
    catch{
    some thing.......
    }
    try{
    some thing.......
    }
    catch{
    some thing.......
    }
    _res.close(); raises Error : must be caught or declared to be thrown
    _ps.close(); raises Error : must be caught or declared to be thrown

    }

    Why do I get this error? Should I close _res and _ps in each of the catch terms(i tried inside finally term but I got the same error).
    Please advise
    Yossi

  2. #2
    Join Date
    Aug 2002
    Posts
    46

    Smile

    I added throws Exception to the routine declaration and the problem was solved.
    Thnaks any way
    Garfild

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •