i essentially have a query that generates a list of items (column 1) and their descriptions (column 2). There are 3 different items (out of 170) that do not have a description, so i hard coded my program to adjust for those 3 items. However, whenever my reader gets to the first item that has a null column, the reader is not even able to read the Item. Instead it says "Enumeration Yielded No Results"
var reader = command.ExecuteReader();
while (reader.Read())
{
var node = reader[0] as string;
string fullNodeName = string.Empty;
if (string.IsNullOrEmpty((string)reader[1]))
{
switch ((string)reader[0])
{
case "xxx":
fullNodeName = "jhhfgnfh";
break;
case "xxx":
fullNodeName = "fhnfgndfgdh";
break;
case "xxx":
fullNodeName = "werqrqwerq";
break;
}
}
else
{
fullNodeName = reader[1] as string;
}
_nodeTokenList.Add(new Carriers.NodeToken(node, string.Format("{0} - {1}", node, fullNodeName)));
}
the data looks something like
Node Description
XXX || YYYYYYY YYY YYY
XXX || YYYYYYY YYY YYY
XXX || YYYYYYY YYY YYY
XXX || YYYYYYY YYY YYY
XXX ||
XXX || YYYYYYY YYY YYY
the row with the null description field is when the program starts acting up. Whats weird is that it enters the while loop for this row, but the exception gets caught at var node = reader[0] as string; (the field that is NOT null)