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

前端 未结 6 1893
别跟我提以往
别跟我提以往 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:12

    Just check for

    if(table.rows[0][0] == null)
    {
         //Whatever I want to do
    }
    

    or you could

    if(t.Rows[0].IsNull(0))
    {
         //Whatever I want to do
    }
    

提交回复
热议问题