public ArrayList GetProducts()
{
ArrayList alProducts = new ArrayList();
string strSelect = "SELECT ProductCode, Description, "
+ "UnitPrice FROM Products";
SqlConnection theSqlConnection = Connection();
SqlCommand theSqlCommand = new SqlCommand(strSelect,
theSqlConnection);
theSqlConnection.Open();
SqlDataReader productReader;
// would love to know why the following is giving me
// the exception
productReader = theSqlCommand.ExecuteReader();
while (productReader.Read())
{
alProducts.Add(productReader["ProductCode"]);
alProducts.Add(productReader["Description"]);
alProducts.Add(productReader["UnitPrice"]);
}
productReader.Close();
theSqlConnection.Close();
return alProducts;
}
Everything else works great until it gets to the reader.
Everything I know I learned from The Grateful Dead and Buffy The Vampire Slayer
Charlie
{
ArrayList alProducts = new ArrayList();
string strSelect = "SELECT ProductCode, Description, "
+ "UnitPrice FROM Products";
SqlConnection theSqlConnection = Connection();
SqlCommand theSqlCommand = new SqlCommand(strSelect,
theSqlConnection);
theSqlConnection.Open();
SqlDataReader productReader;
// would love to know why the following is giving me
// the exception
productReader = theSqlCommand.ExecuteReader();
while (productReader.Read())
{
alProducts.Add(productReader["ProductCode"]);
alProducts.Add(productReader["Description"]);
alProducts.Add(productReader["UnitPrice"]);
}
productReader.Close();
theSqlConnection.Close();
return alProducts;
}
Everything else works great until it gets to the reader.
Everything I know I learned from The Grateful Dead and Buffy The Vampire Slayer
Charlie