SQL SERVER, DataRows and Null Dates



Hi all

I've spent ages looking on google for the answer to what I would guess is a
really common problem. Can anyone here help me out.

I read a view from SQL Server 2000 into a DataSet
>From here I select some rows matching a certain criterea.
In the selected row is a column of type datetime that I'm interested in.
Before assigning a local variable to the value in the DataRow Column, I
simply want to check if its null

i.e.
DateTime InspectionDate;

foreach (DataRow CurrentRow in FinalSide)

{


if (sqldatenull.CompareTo(CurrentRow["upload_date"]) ????? or anything to
check for non null ????? == 0 )

{

InspectionDate= Convert.ToDateTime(CurrentRow["upload_date"]);

MessageBox.Show(InspectionDate.ToLongDateString());

}

}


I can't find anything to check if its empty of of its Null.

The best I can do is to use convert and catch the exception error, but I'm
guessing there must be a cleaner way of doing this.

thanks in advance

Andy


.



Relevant Pages

  • RE: SQL SERVER, DataRows and Null Dates
    ... "aaj" wrote: ... > From here I select some rows matching a certain criterea. ... > In the selected row is a column of type datetime that I'm interested in. ... > Before assigning a local variable to the value in the DataRow Column, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: SQL SERVER, DataRows and Null Dates
    ... You should check it agains DBNull.Value. ... Next time you get something like this, it's very easy to know the type/value ... > In the selected row is a column of type datetime that I'm interested in. ... > Before assigning a local variable to the value in the DataRow Column, ...
    (microsoft.public.dotnet.languages.csharp)