.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

ruby - When to use an ORM (Sequel, Datamapper, AR, etc.) vs. pure SQL for querying -

php - PHPDoc: @return void necessary? -

c++ - Convert big endian to little endian when reading from a binary file -