public SubCategoryList GetFilteredSubCategories(SubCategoryFilter SCFilter) { SqlDataReader dataReader = null; SubCategoryList SCList = null; try { SqlCommand sqlCommand = ProjectConnection.CreateCommand(); sqlCommand.CommandText = GETFILTERED_SUBCategory_SP; sqlCommand.Parameters.Add(new SqlParameter(SUBCATEGORY_PARENTID_PARAM, SqlDbType.Int)).Value = SCFilter.SubCategory.ParentID; sqlCommand.CommandType = CommandType.StoredProcedure; ProjectConnection.Open(); dataReader = sqlCommand.ExecuteReader(); SCList = new SubCategoryList(); while (dataReader.Read()) { SubCategory I = new SubCategory(); I.FillForObject(dataReader); SCList.Rows.Add(I); } dataReader.Close(); ProjectConnection.Close(); } catch (Exception ex) { throw new Exception("SUBCATEGORY", ex); } finally { if (!dataReader.IsClosed) { dataReader.Close(); } if (ProjectConnection.State == ConnectionState.Open) { ProjectConnection.Close(); } } return(SCList); }