if (randomCategoryReader.Read()) { string categoryName = randomCategoryReader["CategoryName"].ToString(); ... }