执行 query_cbtyt.ApplyUpdates();出错?

解决方案 »

  1.   

    procedure Tfrm_XTDZDDYXX.btn_addClick(Sender: TObject);
    begin
      if (dh0='') or(syzdz0='') then
      begin
        messagebox(handle,'参数传递有错误,请与系统管理员联系','严重错误',mb_iconerror);
        exit;
      end;
      try
      if not sub_table.Active then sub_table.Active:=true;
      GroupBox1.Enabled:=true;
      sub_table.Append;
      sub_table.FieldByName('dh').AsString:=dh0;
      sub_table.FieldByName('syzdz').AsString:=syzdz0;
      sub_table.FieldByName('srry').AsString:=user_info.yhmc;
      sub_table.FieldByName('srrq').AsString:=formatdatetime('yyyy-mm-dd',now);
      sub_table.FieldByName('xgry').AsString:=user_info.yhmc;
      sub_table.FieldByName('xgrq').AsString:=formatdatetime('yyyy-mm-dd',now);
      //opendialog1.Filter:='All (*.'+wjhz0+')|*.'+wjhz0;
     //  opendialog1.Filter:='All (*.jpg;*.jpeg;*.bmp;*.ico;*.emf;*.wmf)|*.jpg;*.jpeg;*.bmp;*.ico;*.emf;*.wmf';
      if opendialog1.Execute then
      begin
        if (getfilesize(opendialog1.FileName)/(1024*1024))>8.0 then
        begin
          messagebox(handle,pchar('文件大小不能超过8M,请选择其它的文件!'),'错误信息-文件太大',mb_iconerror);
          sub_table.Cancel;
          GroupBox1.Enabled:=false;
          exit;
        end;
        sub_Table.Edit;
        (sub_Table.FieldByName('nr') as tblobfield).LoadFromFile(opendialog1.FileName);
        wjhz0:=uppercase(ExtractFileExt(opendialog1.FileName));
        delete(wjhz0,1,1);
        sub_table.FieldByName('wjhzmc').AsString:=wjhz0;
        try
        sub_table.Connection.BeginTrans;
       // sub_table.Database.StartTransaction;
        sub_table.Post;
        finally
       // sub_table.Database.Commit;
        sub_table.Connection.CommitTrans;
        end;
        sub_table.close;
        sub_table.Open;
        if image1.Visible then  showimage;
        btn_add.Enabled:=false;
        if sub_table.RecordCount >0 then
        begin
        OleContainer1.CreateObjectFromFile(opendialog1.FileName,false);
        OleContainer1.run;
        OleContainer1.Visible:=true;
        end;
      end
      else
      begin
      sub_table.Cancel;
      GroupBox1.Enabled:=false;
      end;
      except
      sub_table.Cancel;
      GroupBox1.Enabled:=false;
      end;
    end;
      

  2.   

    好错了,
    你试试
    query_cbtyt.ApplyUpdates(1);
      

  3.   

    偶还以为是Tuxedo的东西呢?一场误会!