现在我有一个数据(日期型的),我打算把它从界面上显示出来,和这个数据相对应的是一个datetimepicker控件,我用了下面这种方法但是不行,
sshtbianji.datetimepicker1.Date:=datamodule.ADOTable.fieldByName('htqdt').AsDateTime;
我输入的时候用的语句是这样的:
datamodule.ADOTable.fieldByName('htqdt').AsDateTime:=sshtbianji.datetimepicker1.Date;
希望大哥们帮帮我!!!!!!!!!!!

解决方案 »

  1.   

    第一句话应该是这样的。
    sshtbianji.datetimepicker1.Date:=datamodule.ADOTable.fieldByName('htqdt').AsDate;
      

  2.   

    不好意思,错了是下面这样的
    sshtbianji.datetimepicker1.DateTime:=datamodule.ADOTable.fieldByName('htqdt').AsDateTime;
      

  3.   

    sshtbianji.datetimepicker1.DateTime:=datamodule.ADOTable.fieldByName('htqdt').AsDateTime;
      

  4.   

    ---------------------------
    Debugger Exception Notification
    ---------------------------
    Project gfguanliProject.exe raised exception class EAccessViolation with message 'Access violation at address 004CAD82 in module 'gfguanliProject.exe'. Read of address 00000320'. Process stopped. Use Step or Run to continue.
    ---------------------------
    OK   Help   
    ---------------------------
    ---------------------------
    Debugger Exception Notification
    ---------------------------
    Project gfguanliProject.exe raised exception class EAccessViolation with message 'Access violation at address 004CAF62 in module 'gfguanliProject.exe'. Read of address 00000320'. Process stopped. Use Step or Run to continue.
    ---------------------------
    OK   Help   
    ---------------------------
    ---------------------------
    gfguanliproject
    ---------------------------
    Access violation at address 004CAF62 in module 'gfguanliProject.exe'. Read of address 00000320.
    ---------------------------
    确定   
    ---------------------------
      

  5.   

    你有没有打开adotable呀
    或者你设置的连接有问题
      

  6.   

    我再说的详细一点吧!
    我在adotable的AfterScroll事件中写了这么一段程序!
    procedure Tgfgldatamodule.ADOTableAfterScroll(DataSet: TDataSet);
    begin
    if (gfgldatamodule.sshtbianji_ADOT.FieldByName('htbhao').AsString<>'') then
    begin
    try
      sshtbianji.htqdt.DateTime:=gfgldatamodule.sshtbianji_ADOT.fieldByName('htqdt').AsDateTime;
     except
      sshtbianji.htqdt.Date:=now;
       end
    else
       begin
        sshtbianji.htqdt.Date:=now;
    end
    end;
      

  7.   

    gfgldatamodule.sshtbianji_ADOT.open;
    gfgldatamodule.sshtbianji_ADOT.first;
      

  8.   

    还是不行呀,我刚用f7调的,再运行完gfgldatamodule.sshtbianji_adot.open后,执行的Tgfgldatamodule.ADOTableAfterScroll(DataSet: TDataSet);
    紧接着就出现了那些错误
      

  9.   

    老兄,怎么调用ADOTableAfterScroll?指针到尾了吧?还是没有查询到记录?