Tuesday, August 11, 2009

Best Practices for Using ADO.NET

Good Article of ADO.NET

http://msdn.microsoft.com/en-us/library/ms971481.aspx

SqlDataReader.Close Method

You must explicitly call the Close method when you are through using the SqlDataReader to use the associated SqlConnection for any other purpose.

The Close method fills in the values for output parameters, return values and RecordsAffected, increasing the time that it takes to close a SqlDataReader that was used to process a large or complex query. When the return values and the number of records affected by a query are not significant, the time that it takes to close the SqlDataReader can be reduced by calling the Cancel method of the associated SqlCommand object before calling the Close method.

http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqldatareader.close.aspx

No comments: