vb.net - Error handling with data tables -
i have loop data table , i'm trying figure out if data table has no rows in it. ignore fact there no rows in , move on or fail , give , exception? here's code loop, question should same in cases.
each dr datarow in dt.rows if not isdbnull(dr.item("materialid")) , dr.item("materialid") isnot nothing listofresults.add(cuint(dr.item("materialid"))) else trace.traceerror("error details: {0} stack: {1}", "the materialid nothing/null", system.reflection.methodinfo.getcurrentmethod.tostring) end if next
if datatable has no rows hit loop , exit , execute next statement after loop. note : if datatable dt nothing throw exception.
Comments
Post a Comment