title: null datetime value 30/12/1899 or 01/01/1800
body: <p>I have the following...</p>
  
  <pre><code>var
    LCnn: TADOConnection;
    qryGetData: TADOQuery;
  begin
    ...
    //build a connection string to a SQL Server 2008
    ...
    qryGetData.Connection := LCnn;
    qryGetData.SQL.Text := 'SELECT * FROM MYTABLE'
    ...
    LDate := qryGetData.FieldByName('Date').AsDateTime; //Date its a datetime field in the table
  
  end;
  </code></pre>
  
  <p>This works fine but, when "Date" field is NULL in some Pcs the LDate is 0 and in another is -36522. </p>
  
  <p>Any idea???
  Thanks!</p>
  
  <p>edit:</p>
  
  <p>the stranges behavior is </p>
  
  <pre><code>function TDateTimeField.GetAsDateTime: TDateTime;
  begin
    if not GetValue(Result) then Result := 0;
  end;
  </code></pre>
  
  <p>in the firts case, GetValue result is false so GetAsDateTime result is 0, in the second case GetValue result is true so return -36522 (01/01/1800)</p>