请各位高手帮小弟看一下,运行下面的程序更新不了数据库(累加器),请指点(0分)

  • 主题发起人 主题发起人 dmk888
  • 开始时间 开始时间
D

dmk888

Unregistered / Unconfirmed
GUEST, unregistred user!
数据库里的字段都是字符型的
procedure Tdatahouse.orderdatasetNewRecord(DataSet: TDataSet);
var
vyear,vmonth,vday:word;
smonth,sday:string;
begin
decodedate(now,vyear,vmonth,vday);
iddataset.open;
if length(inttostr(vmonth))=1 then
smonth:='0'+inttostr(vmonth) else
smonth:=inttostr(vmonth);
if length(inttostr(vday))=1 then
sday:='0'+inttostr(vday) else
sday:=inttostr(vday);
if not iddataset.Locate('日期',inttostr(vyear)+smonth+sday,[]) then
begin
iddataset.Append;
iddatasetCDSDesigner.Value:=inttostr(vyear)+smonth+sday;
iddatasetnextid.value:='001';
end;
iddataset.Edit;
orderdatasetCDSDesigner.value:=iddatasetCDSDesigner.value+iddatasetnextid.Value;
if length(inttostr(strtoint(iddatasetnextid.Value)+1))=1 then
iddatasetnextid.Value:='00'+inttostr(strtoint(iddatasetnextid.Value)+1);
if length(inttostr(strtoint(iddatasetnextid.Value)+1))=2 then
iddatasetnextid.Value:='0'+inttostr(strtoint(iddatasetnextid.Value)+1);
if length(inttostr(strtoint(iddatasetnextid.Value)+1))=3 then
iddatasetnextid.Value:=inttostr(strtoint(iddatasetnextid.Value)+1);
iddataset.ApplyUpdates(0);
iddataset.close;
end;
 
在iddataset的OnReconcileError事件中,加ShowMessage(E.Message);看看出了什么错?
 
后退
顶部