• Post Reply Bookmark Topic Watch Topic
  • New Topic

why the error at line 56 ?  RSS feed

 
tangara goh
Ranch Hand
Posts: 282
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I do not know why I keep getting error at line 56.

Hope someone can tell me why ?

Here's my code :

error-at-line-56.jpg
[Thumbnail for error-at-line-56.jpg]
 
shiv darshan
Greenhorn
Posts: 2
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your connection object is not creating. because you are creating the connection obj in catch block . so it will not get executed until try block will throw the exception . so change your code .

Create your con obj in try block
  
 
tangara goh
Ranch Hand
Posts: 282
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
shiv darshan wrote:Your connection object is not creating. because you are creating the connection obj in catch block . so it will not get executed until try block will throw the exception . so change your code .

Create your con obj in try block
  




You mean I can't call the open Connection based on the above method ?
Why ?

It works for my other class ...

So, I have to move the method all together in the try catch block ?

Sorry I just don't understand...
 
shiv darshan
Greenhorn
Posts: 2
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Campbell Ritchie
Marshal
Posts: 56570
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well done, SD, findingthe error, and welcome to the Ranch

Please use the code button; I shall edit your post and you can see how much better it will look
[edit]Also changed indentation for line 4.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!