procedure Tfm_quy_water.btn_wspfzlqnClick(Sender: TObject);
begin
  with dm_land do
  begin
  quy_djnd.Close;
  quy_djnd.SQL.Clear;
  quy_djnd.SQL.Add('select id from djnd where djnd like "%'+edit_year.Text+'%"');
  quy_djnd.RequestLive:=true;
  quy_djnd.Open;    quy_wspf.Close;
    quy_wspf.SQL.Clear;
    quy_wspf.SQL.Add('select sum(wspfl) from wspf,djnd where wspf.id=djnd.id');
    quy_wspf.RequestLive:=true;
    quy_wspf.Open;
    edit_sum_pfl.Text:=quy_wspf.Fields[0].Value;
  end;
end;错误提示 table id read only!

解决方案 »

  1.   

    在quy_djnd.Close;语句设置断点,调试一下,看是哪一行代码出的问题,再提问好不?
      

  2.   

    quy_wspf.fields[0].value出错,我怀疑是他。但不知道怎么改
      

  3.   

    SQL语言有问题
    select sum(wspfl) as sumwspfl from wspf,djnd where wspf.id=djnd.id'
    ........edit_sum_pfl.Text:=quy_wspf.fieldByName('sumwspfl').asString;
      

  4.   

    quy_wspf.fields[0].value-->
    quy_wspf.fields[0].asstring;
      

  5.   

    select sum(wspfl) from wspf....这里有问题sum以后就是只读的了,不能RequestLive:=true