提示信息一:
---------------------------
Debugger Exception Notification
---------------------------
Project gfguanliProject.exe raised exception class EAccessViolation with message 'Access violation at address 004D0EF6 in module 'gfguanliProject.exe'. Read of address 00000328'. Process stopped. Use Step or Run to continue.
---------------------------
OK Help
---------------------------
2:
---------------------------
Debugger Exception Notification
---------------------------
Project gfguanliProject.exe raised exception class EAccessViolation with message 'Access violation at address 004D10D6 in module 'gfguanliProject.exe'. Read of address 00000328'. Process stopped. Use Step or Run to continue.
---------------------------
OK Help
---------------------------
3:
---------------------------
gfguanliproject
---------------------------
Access violation at address 004D10D6 in module 'gfguanliProject.exe'. Read of address 00000328.
---------------------------
确定
---------------------------
代码如下:
procedure Tgfgldatamodule.sshtbianji_ADOTAfterScroll(DataSet: TDataSet);
begin
if (gfgldatamodule.sshtbianji_ADOT.FieldByName('htbhao').AsString<>'') then
begintry
sshtbianji.htqdt.Date:=gfgldatamodule.sshtbianji_ADOT.fieldByName('htqdt').AsDateTime;
sshtbianji.schtjq.Date:=gfgldatamodule.sshtbianji_ADOT.fieldByName('sshtjq').AsDateTime;
sshtbianji.htyfbst.Date:=gfgldatamodule.sshtbianji_ADOT.fieldByName('htyfbst').AsDateTime;
sshtbianji.htyfbyt.Date:=gfgldatamodule.sshtbianji_ADOT.fieldByName('htyfbyt').AsDateTime;
sshtbianji.htjcbyt.Date:=gfgldatamodule.sshtbianji_ADOT.fieldByName('htjcbyt').AsDateTime;
sshtbianji.htjcbst.Date:=gfgldatamodule.sshtbianji_ADOT.fieldByName('htjcbst').AsDateTime;
sshtbianji.htysbyt.Date:=gfgldatamodule.sshtbianji_ADOT.fieldByName('htysbyt').AsDateTime;
sshtbianji.htysbst.Date:=gfgldatamodule.sshtbianji_ADOT.fieldByName('htysbst').AsDateTime;
sshtbianji.htyebyt.Date:=gfgldatamodule.sshtbianji_ADOT.fieldByName('htyebyt').AsDateTime;
sshtbianji.htyebst.Date:=gfgldatamodule.sshtbianji_ADOT.fieldByName('htyebst').AsDateTime;
except
sshtbianji.htqdt.Date:=now;
sshtbianji.schtjq.Date:=now;
sshtbianji.htyfbst.Date:=now;
sshtbianji.htyfbyt.Date:=now;
sshtbianji.htjcbyt.Date:=now;
sshtbianji.htjcbst.Date:=now;
sshtbianji.htysbyt.Date:=now;
sshtbianji.htysbst.Date:=now;
sshtbianji.htyebyt.Date:=now;
sshtbianji.htyebst.Date:=now;
end ;
end
else
begin
sshtbianji.htqdt.Date:=now;
sshtbianji.schtjq.Date:=now;
sshtbianji.htyfbst.Date:=now;
sshtbianji.htyfbyt.Date:=now;
sshtbianji.htjcbyt.Date:=now;
sshtbianji.htjcbst.Date:=now;
sshtbianji.htysbyt.Date:=now;
sshtbianji.htysbst.Date:=now;
sshtbianji.htyebyt.Date:=now;
sshtbianji.htyebst.Date:=now;
end end;
---------------------------
Debugger Exception Notification
---------------------------
Project gfguanliProject.exe raised exception class EAccessViolation with message 'Access violation at address 004D0EF6 in module 'gfguanliProject.exe'. Read of address 00000328'. Process stopped. Use Step or Run to continue.
---------------------------
OK Help
---------------------------
2:
---------------------------
Debugger Exception Notification
---------------------------
Project gfguanliProject.exe raised exception class EAccessViolation with message 'Access violation at address 004D10D6 in module 'gfguanliProject.exe'. Read of address 00000328'. Process stopped. Use Step or Run to continue.
---------------------------
OK Help
---------------------------
3:
---------------------------
gfguanliproject
---------------------------
Access violation at address 004D10D6 in module 'gfguanliProject.exe'. Read of address 00000328.
---------------------------
确定
---------------------------
代码如下:
procedure Tgfgldatamodule.sshtbianji_ADOTAfterScroll(DataSet: TDataSet);
begin
if (gfgldatamodule.sshtbianji_ADOT.FieldByName('htbhao').AsString<>'') then
begintry
sshtbianji.htqdt.Date:=gfgldatamodule.sshtbianji_ADOT.fieldByName('htqdt').AsDateTime;
sshtbianji.schtjq.Date:=gfgldatamodule.sshtbianji_ADOT.fieldByName('sshtjq').AsDateTime;
sshtbianji.htyfbst.Date:=gfgldatamodule.sshtbianji_ADOT.fieldByName('htyfbst').AsDateTime;
sshtbianji.htyfbyt.Date:=gfgldatamodule.sshtbianji_ADOT.fieldByName('htyfbyt').AsDateTime;
sshtbianji.htjcbyt.Date:=gfgldatamodule.sshtbianji_ADOT.fieldByName('htjcbyt').AsDateTime;
sshtbianji.htjcbst.Date:=gfgldatamodule.sshtbianji_ADOT.fieldByName('htjcbst').AsDateTime;
sshtbianji.htysbyt.Date:=gfgldatamodule.sshtbianji_ADOT.fieldByName('htysbyt').AsDateTime;
sshtbianji.htysbst.Date:=gfgldatamodule.sshtbianji_ADOT.fieldByName('htysbst').AsDateTime;
sshtbianji.htyebyt.Date:=gfgldatamodule.sshtbianji_ADOT.fieldByName('htyebyt').AsDateTime;
sshtbianji.htyebst.Date:=gfgldatamodule.sshtbianji_ADOT.fieldByName('htyebst').AsDateTime;
except
sshtbianji.htqdt.Date:=now;
sshtbianji.schtjq.Date:=now;
sshtbianji.htyfbst.Date:=now;
sshtbianji.htyfbyt.Date:=now;
sshtbianji.htjcbyt.Date:=now;
sshtbianji.htjcbst.Date:=now;
sshtbianji.htysbyt.Date:=now;
sshtbianji.htysbst.Date:=now;
sshtbianji.htyebyt.Date:=now;
sshtbianji.htyebst.Date:=now;
end ;
end
else
begin
sshtbianji.htqdt.Date:=now;
sshtbianji.schtjq.Date:=now;
sshtbianji.htyfbst.Date:=now;
sshtbianji.htyfbyt.Date:=now;
sshtbianji.htjcbyt.Date:=now;
sshtbianji.htjcbst.Date:=now;
sshtbianji.htysbyt.Date:=now;
sshtbianji.htysbst.Date:=now;
sshtbianji.htyebyt.Date:=now;
sshtbianji.htyebst.Date:=now;
end end;
全都改成这样AsDate试试。
procedure Tsshtbianji.saveClick(Sender: TObject);
begin
gfgldatamodule.sshtbianji_ADOT.fieldByName('htqdt').AsDateTime:=htqdt.Date;
gfgldatamodule.sshtbianji_ADOT.fieldByName('sshtjq').AsDateTime:=schtjq.Date;
gfgldatamodule.sshtbianji_ADOT.fieldByName('htyfbst').AsDateTime:=htyfbst.Date;
gfgldatamodule.sshtbianji_ADOT.fieldByName('htyfbyt').AsDateTime:=htyfbyt.Date;
gfgldatamodule.sshtbianji_ADOT.fieldByName('htjcbyt').AsDateTime:=htjcbyt.Date;
gfgldatamodule.sshtbianji_ADOT.fieldByName('htjcbst').AsDateTime:=htjcbst.Date;
gfgldatamodule.sshtbianji_ADOT.fieldByName('htysbyt').AsDateTime:=htysbyt.Date;
gfgldatamodule.sshtbianji_ADOT.fieldByName('htysbst').AsDateTime:=htysbst.Date;
gfgldatamodule.sshtbianji_ADOT.fieldByName('htyebyt').AsDateTime:=htyebyt.Date;
gfgldatamodule.sshtbianji_ADOT.fieldByName('htyebst').AsDateTime:=htyebst.Date;
try
gfgldatamodule.sshtbianji_ADOT.Post;
edit.Enabled:=true;
cancel.Enabled:=false;
save.Enabled:=false;
query.Enabled:=true;
exit.Enabled:=true;
append.Enabled:=true;
/// 保存的时候设置为“只读”类型的2002-11-15
dbedit1.ReadOnly:=true;
dbedit2.ReadOnly:=true;
dbedit3.ReadOnly:=true;
dbedit4.ReadOnly:=true;
dbedit5.ReadOnly:=true;
dbedit6.ReadOnly:=true;
dbedit7.ReadOnly:=true;
dbedit8.ReadOnly:=true;
dbedit9.ReadOnly:=true;
dbedit10.ReadOnly:=true;
dbedit11.ReadOnly:=true;
dbedit12.ReadOnly:=true;
dbedit24.ReadOnly:=true;
dbedit25.ReadOnly:=true;
dbedit26.ReadOnly:=true;
dbedit27.ReadOnly:=true;
dbedit28.ReadOnly:=true;
dbedit29.ReadOnly:=true;
dbedit30.ReadOnly:=true;
dbedit31.ReadOnly:=true;
dbedit32.ReadOnly:=true;
dbedit33.ReadOnly:=true;
dbmemo1.ReadOnly:=true;
dbmemo2.ReadOnly:=true;
///
except
showmessage('填写的信息不完整!');
end;end;
datetimetostr
就没问题了
ACCESS的日期要搞成STR存取才行。
:)