SqlHelper.ExecuteDataset, do I need to open and close the connection explicitly ???

Asked By Pranay Singh
20-Nov-09 02:22 PM
Earn up to 0 extra points for answering this tough question.

When I am using SqlHelper.ExecuteNonquery or SqlHelper.ExecuteDataset,  do I need to open and close the connection explicitly  ???

Thank you

  if you are using the SqlHelper utility class

Peter Bromberg replied to Pranay Singh
20-Nov-09 02:45 PM
it will open and close the connection for you.

  Thank you

Pranay Singh replied to Peter Bromberg
20-Nov-09 03:19 PM

Thanks for help !!

End Of POst

  Hope this helps.

[)ia6l0 iii replied to Pranay Singh
21-Nov-09 12:45 PM
Yes, the finally block of those methods would have the "ConnectionObject".Close method call.

But, SQL Helper is quite old, and you can move to better and advanced alternatives such as Enterprise Library Data application blocks.

As a transition from the 1.1 , the SqlHelper class was  was actually replaced with an abstract class - Database from which two other classes derived from it. the  SqlDatabase and the OracleDatabase classes.


Create New Account