可以将TDatetimePicker传回来的时间转成字串再填入库中。

解决方案 »

  1.   

    空的问题:设置Tdatetimepicker.ShowCheckBox=True,如果让Checked=False表示为空。兼容的问题:因为Tdatetimepicker不是数据敏感控件,所以你在两者之间转换即可。有什么难处?
    装入时:
    datetimepickerX.Checked := FieldX.IsNull;
    if not FieldX.IsNull then
      datetimepickerX.Date := StrToDate(FieldX.AsString);保存时:
    if datetimepickerX.Checked then
      FieldX.AsString := DateToStr(datetimepickerX.Date)
    else
      FieldX.Clear;如果你是用SQL保存,道理应当相似。