.net - How to find if a value is NULL in SQL Server using c# -


i know values null in datatable in c# returned executedatatable of sqlhelper class.

string select = "select * testtable"; string val="";  datatable  dt=dbcon.executedatatable(select); foreach (datarow dr in dt.rows) {    foreach (datacolumn  dc in dt.columns )    {        if(dr[dc].equals (null))        {           val ="null";        }         else          {           val = dr[dc].tostring();        }    } } 

but unfortunately didn't find way it. please let me know if there way. thank in advance.

as david m's method, can use datarow.isnull:

if (dr.isnull(dc)) 

Comments

Popular posts from this blog

List<T>().Add problem C# -

Javascript natural sort array/object and maintain index association -