Java
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!
Code
list.Add(temp);
}
}
return list;
}
}
}
Ganesh14 pointsPosted Jan 22, 2007, 3:01 PM EST
if( reader["Description"] != null)
{
string description = reader["Description"].ToString()
}
hope this helps