Best way to check if column returns a null value (from database to .net application)

前端 未结 6 1807
别跟我提以往
别跟我提以往 2020-12-09 15:45

I have a table with a DateTime column the column can have NULL values

Now I connect to the database using an ODBC connection and get the value into a DataTable in .n

6条回答
  •  囚心锁ツ
    2020-12-09 16:14

    If we are using EF and reading the database element in while loop then,

       using( var idr = connection, SP.......)
       {
           while(idr.read())
           {
              if(String.IsNullOrEmpty(idr["ColumnNameFromDB"].ToString())
              //do something
           }
       }
    

提交回复
热议问题