use dataset to fetch data from database, because it is connection less.
and then you can compare in this way :
Dataset ds=new Dataset();
ds=
for ( int i=0; i<ds.tables[0].rows.count;>{
if( Convert.ToInt32(ds.Tables[0].Rows[i][2])==100)
{
}
else
{
}
}
Hope this will surely help you.
Don't forget to mark as answer if it helps. :)