请高手进来讨论一个这个问题(0分)

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

dmk888

Unregistered / Unconfirmed
GUEST, unregistred user!
我用的是c/s型中间件执行下面代码更新不了数据,没显示更新成攻对话框
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;
iddataset.fieldbyname('日期').asstring:=inttostr(vyear)+smonth+sday;
iddataset.fieldbyname('nextid').asstring:='001';
end;
iddataset.Edit;
datahouse.orderdataset.fieldbyname('帐单号').asstring:=iddataset.fieldbyname('日期').asstring+iddataset.fieldbyname('nextid').asstring;
case length(inttostr(strtoint(iddataset.fieldbyname('nextid').asstring)+1)) of
1:iddataset.fieldbyname('nextid').asstring:='00'+inttostr(strtoint(iddataset.fieldbyname('nextid').asstring)+1);
2:iddataset.fieldbyname('nextid').asstring:='0'+inttostr(strtoint(iddataset.fieldbyname('nextid').asstring)+1);
3:iddataset.fieldbyname('nextid').asstring:=inttostr(strtoint(iddataset.fieldbyname('nextid').asstring)+1);
end;
iddataset.post;
if iddataset.changecount>0 then
begin
iddataset.ApplyUpdates(-1);
showmessage('更新成功');
end;
iddataset.close;
end;
 
后退
顶部