public static List<Subcategories> GetSubcategories(int SubgroupID)
{
using (SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["XXX"].ConnectionString)){
using (SqlCommand command = new SqlCommand("GetSubcategories", connection)){
command.CommandType =
CommandType.StoredProcedure;command.Parameters.Add(
new SqlParameter("@SubgroupID", SubgroupID));connection.Open();
List<Subcategories> list = new List<Subcategories>(); using (SqlDataReader reader = command.ExecuteReader()){
while (reader.Read()){
Subcategories temp = new Subcategories((
int)reader["SubCategoryId"],(
int)reader["SubgroupID"],(
string)reader["Title"],(
string)reader["Manager"],(
string)reader["Description"]); <----- THIS LINE IS WHERE THE FAILUER OCCURS!list.Add(temp);
}
}
return list;}
}
}
GaneshPosted Jan 22, 2007, 8:01 PM
if( reader["Description"] != null)
{
string description = reader["Description"].ToString()
}
hope this helps