467,212 Members | 1,158 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,212 developers. It's quick & easy.

C# -App : "Unreachable code detected" warning When tyring to close connection to Data

Hi, anyone please help me

when I try to close a connection to the database from a static method, "Unreachable code detected" error occured.

What's the problem actually?
Thank you before
Sep 29 '07 #1
  • viewed: 7192
Share:
3 Replies
kenobewan
Expert 4TB
Please show us the code so we can see why it was unreachable. Thanks.
Sep 29 '07 #2
Shashi Sadasivan
Expert 1GB
Hi, anyone please help me

when I try to close a connection to the database from a static method, "Unreachable code detected" error occured.

What's the problem actually?
Thank you before
Make sure there is a return value at the end.
Most probably you would be returning a value in a conditional statement but did not do it if that condition was false.

A good way is to post a sample of your code so that any errors noticable can be pointed out soon. Or you would end up decyphering it yourself.

cheers
Sep 29 '07 #3
cie
Well anyway thanks for the reply but finally fixed it when I use try - catch - finally blocks. I put the code to close the connection in finally block.

:D
Oct 1 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

8 posts views Thread by teddysnips@hotmail.com | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.