Hi frosty,
If all you need to do is check a single field, then you don't need the DataTable. Instead, you can read from the reader directly:
if (MyReader .Read())
{
someControl.Visible = MyReader .GetBoolean(3);
}
where 3 is the (zero-based) index of the colum you want to read. If you want to improve the readability of the code, you can use GetOrdinal, that returns the index based on a name:
someControl.Visible = MyReader.GetBoolean(MyReader.GetOrdinal("requiresA ddress"))
And if SomeColumn can be null in the database, you can check it before you try to get a boolean:
if (MyReader.IsDBNull(MyReader.GetOrdinal("requiresAd dress")))
{
// value is null
}
Hope this helps,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of
ASP.NET 2.0 Instant Results and
Beginning Dreamweaver MX / MX 2004