将part_amounttemp中的非数字内容去掉后保存到part_amount 可就是保存不上去,大家看什么原因CDS_gsfz.Close;
CDS_gsfz.CommandText:='select part_amounttemp,part_amount from '+DatabaseName+'SC_art_card where part_amounttemp<>''''';//where work_no like ''1000%''
CDS_gsfz.Open;
//调用自定义过程,创建进度条
  Create_ProgressBar(CDS_gsfz.RecordCount);
  StatusBar_foot.Panels[0].Text :='正在转换...';
  StatusBar_foot.Refresh ;
  CDS_gsfz.First ;
  while not CDS_gsfz.Eof do
  begin
      ProgressBar_jd.StepIt; //进度条进一步
      s1:='0';
      ss:=CDS_gsfz.fieldbyname('part_amounttemp').AsString;
      if length(ss)>0 then
      begin
        for i:=1 to length(ss) do
         begin
          try
          if ss[i] in ['0'..'9'] then
            s1:=s1+ss[i];
          if (ss[i]='+')and (ss[i+1] in ['0'..'9']) then
            s1:=inttostr(strtoint(s1)+strtoint(ss[i+1]));
          if (ss[i]='×')and (ss[i+1] in ['0'..'9']) then
            s1:=inttostr(strtoint(s1)*strtoint(ss[i+1]));
          except
          MessageBox(Handle,'无法复制','提示信息', MB_ICONINFORMATION or MB_OK);
          end;
         end;
      end;
    CDS_gsfz.Edit;
    CDS_gsfz.fieldbyname('part_amount').AsString:=s1;
    CDS_gsfz.Next;
  end;
  CDS_gsfz.ApplyUpdates(-1);

解决方案 »

  1.   

    你Show下Message看看,我觉得你的Select语句本身就不对。from '+DatabaseName+'SC_art_card
      

  2.   

    是否需要一个
    CDS_gsfz.Edit;
    CDS_gsfz.fieldbyname('part_amount').AsString:=s1;
    CDS_gsfz.Post;
      

  3.   

    Calls CheckBrowseMode to post any pending changes to a prior record if necessary.
    Checks the CanModify property and raises an exception if the dataset can抰 be edited.
    Calls the BeforeEdit event handler.
    Retrieves the record.
    Puts the dataset into dsEdit state, enabling the application or user to modify fields in the record.
    Broadcasts the state change to associated controls.
    Calls the AfterEdit event handler.判断以下CDS_gsfz.CanMOdify 是否是True ;否则是不能修改的