Hi All,
If I have something like this:
using( SqlCommand sqlCmd = CreateSqlCommand( "load_collection_get", false ) )
{
// Code
}
CreateSqlCommand looks like:
public static SqlCommand CreateSqlCommand( string storedProc, bool transaction )
{
SqlCommand sqlCmd = new SqlCommand( storedProc, sqlHelper.GetConnection() );
sqlCmd.CommandType = System.Data.CommandType.StoredProcedure;
if( transaction )
sqlCmd.Transaction = sqlHelper.GetTransaction();
return ( sqlCmd );
}
SqlHelper.GetConnection() returns an opened SqlCommand object
At the end of the using( SqlCommand ... ) will that close the connection for me? Or do i still need to call SqlConnection.Close before the end of the using?