All, I am trying to find a elegant way to retrieve value from a DataRow
. Below is the way I had tried. please review it .And I think it is not good enough. Because it would be verbose when the number of fields which I want to retrieve is big. Any better idea? thanks.
int result = -1;
if (row["intCol"] != null)
{
bool bresult = int.TryParse(row["intCol"].ToString(), out result);
}
Updated
The intCol
data type in DB is nullable string.
Updated
Found it from Most efficient way to check for DBNull and then assign to a variable?
Cheers.