Extra checks for db null dates

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2341 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
jujibo
2012-03-15 10:36:27 +00:00
parent 07bc0b98a9
commit a7d87c1cfa

View File

@ -320,7 +320,10 @@ begin
else
begin
ShowMessage(Format(SInvalidDateTime, [CellEditor.Caption]));
CellEditor.Text := FormatDateTime(DisplayFormat, Field.AsDateTime);
if Field.IsNull then
CellEditor.Text:= ''
else
CellEditor.Text := FormatDateTime(DisplayFormat, Field.AsDateTime);
end;
end;
@ -363,7 +366,10 @@ begin
(not IsValidDateTimeString(NormalizeDateTime(CellEditor.Caption, theValue))) then
begin
ShowMessage(Format(SInvalidDateTime, [CellEditor.Caption]));
CellEditor.Text := FormatDateTime(DisplayFormat, theValue);
if Field.IsNull then
CellEditor.Text:= ''
else
CellEditor.Text := FormatDateTime(DisplayFormat, theValue);
CellEditor.SelectAll;
Key := VK_UNKNOWN;
end
@ -499,7 +505,10 @@ begin
else
begin
ShowMessage(Format(SInvalidTime, [CellEditor.Caption]));
CellEditor.Text := FormatDateTime(DisplayFormat, Field.AsDateTime);
if Field.IsNull then
CellEditor.Text:= ''
else
CellEditor.Text := FormatDateTime(DisplayFormat, Field.AsDateTime);
end;
end;
end;
@ -540,7 +549,10 @@ begin
(not IsValidTimeString(NormalizeTime(CellEditor.Caption, theValue))) then
begin
ShowMessage(Format(SInvalidTime, [CellEditor.Caption]));
CellEditor.Text := FormatDateTime(DisplayFormat, theValue);
if Field.IsNull then
CellEditor.Text:= ''
else
CellEditor.Text := FormatDateTime(DisplayFormat, theValue);
CellEditor.SelectAll;
Key := VK_UNKNOWN;
end
@ -676,7 +688,10 @@ begin
else
begin
ShowMessage(Format(SInvalidDate, [CellEditor.Caption]));
CellEditor.Text := FormatDateTime(DisplayFormat, Field.AsDateTime);
if Field.IsNull then
CellEditor.Text:= ''
else
CellEditor.Text := FormatDateTime(DisplayFormat, Field.AsDateTime);
end;
end;
end;
@ -718,7 +733,10 @@ begin
(not IsValidDateString(NormalizeDate(CellEditor.Caption, theValue))) then
begin
ShowMessage(Format(SInvalidDate, [CellEditor.Caption]));
CellEditor.Text := FormatDateTime(DisplayFormat, theValue);
if Field.IsNull then
CellEditor.Text:= ''
else
CellEditor.Text := FormatDateTime(DisplayFormat, theValue);
CellEditor.SelectAll;
Key := VK_UNKNOWN;
end