今天我的同事发邮件过来说我写的代理分销系统中,分销商商品商品销售范围指定单中,删除单品提示出错,提示是:"capability not supported"。我原来是认为是表结构建立的不正确的!
create table "informix".rangeitem
(
sheetid char(16) not null ,
vgno integer not null ,
price decimal(12,2) not null ,
mlv decimal(5,2)
default 0 not null ,
supplyid char(6),
primary key (sheetid,vgno,supplyid)
) extent size 16 next size 16 lock mode page;
但是看了之后,没有一点问题啊,和以前的对表的控制一样的啊,怎么会出错呢?结合我的程序,问题是:我在保存之前,加上了下面的话。
procedure TForm880011.btnApplyClick(Sender: TObject);
begin
query1.First;
while not query1.Eof do
begin
query1.edit;
if query1price.Value =0 then Query1mlv.Value :=0
else Query1mlv.Value := round((query1price.Value-query1cost.Value)/query1price.Value*100);
query1.Next;
end;
inherited;
end;
正式由于这个循环语句,导致了,删除时出错!我修改了程序,把对毛利率的计算,放在
procedure TForm880011.Query1priceChange(Sender: TField);
begin
inherited;
if query1price.Value =0 then Query1mlv.Value :=0
else Query1mlv.Value := round((query1price.Value-query1cost.Value)/query1price.Value*100);
end;
这样问题,就迎刃而解了!
总结,出现这样的问题,肯定是程序控制除了问题,请仔细检查自己的程序,是否有瑕疵!