Don't it should be Open at the momment to initialize the SQLConnection varaible?
Should I explicit close the SQlConnection now?
... or the using statement do this?
1. No, you will have to open the connection yourself. It is not opened automatically.
2. You don't need to close it explicitly if you are using a using statement.
3. Yes, the using statement will make sure that the connection is closed and disposed when leaving the using block.
Please 'Mark as Answer' if this post helped you.
Marked as answer by Lesthad_mk on Apr 30, 2012 03:49 PM
mm10
Contributor
6409 Points
1184 Posts
Re: Connection State closed when Initialize an SQLConnection
Apr 30, 2012 03:40 PM|LINK
1. No, you will have to open the connection yourself. It is not opened automatically.
2. You don't need to close it explicitly if you are using a using statement.
3. Yes, the using statement will make sure that the connection is closed and disposed when leaving the using block.