• 修改完成状态(类写法)


    1,定义批量修改完成状态类

    unit UUpdateWanChengState;
    
    interface
    uses
      Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
      Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ComCtrls, Data.DB, Data.Win.ADODB,
      Vcl.ExtCtrls, Vcl.DBCtrls, Vcl.Grids, Vcl.DBGrids, Clipbrd, Vcl.Menus,
      Vcl.StdCtrls, DBGridEhGrouping, ToolCtrlsEh, DBGridEhToolCtrls, DynVarsEh,
      EhLibVCL, GridsEh, DBAxisGridsEh, DBGridEh,EhLibADO,DBGridEhImpExp;
    
      /// <summary>
      /// 定义右键批量修改完成状态类
      /// </summary>
    type TUpdateWanChengState=class
      public
      class procedure updatewanchengstate(const SValue: string; var SAdq: TADOQuery);
    end;
    
    implementation
    
    uses FDataPool, 日常管理助手;
    class procedure TUpdateWanChengState.updatewanchengstate(const SValue: string;var SAdq: TADOQuery);
    var
    SAdoq:TADOQuery;
    SBiao: string;
    begin
    try
    SAdoq:=TADOQuery.Create(nil);
    SAdoq.Connection:=frmDataPool.ADOConnection1;
    SBiao:=copy(SAdq.name,4,length(SAdq.name)-3);
     with SAdoq do
     begin
      close;
      SQL.Text:='UPDATE '+SBiao+' SET 状态 = '+SValue.QuotedString+' WHERE 选中 = true';
      ExecSQL;
     end;
     //防止程序假死
     Application.ProcessMessages;
     //刷新纪录
     SAdq.Requery();
    finally
      SAdoq.Free;
    end;
    end;
    
    end.

    2,类引用实现应用:

    注意记得添加需要引用的类的单元名UUpdateWanChengState

    procedure TForm3.N25Click(Sender: TObject);
    begin
    //右击批量修改完成状态为未开始
      TUpdateWanChengState.updatewanchengstate('未开始',frmDataPool.qry需要做的事);
    end;
    
    
    procedure TForm3.N26Click(Sender: TObject);
    begin
    //右击批量修改完成状态为正在进行
      TUpdateWanChengState.updatewanchengstate('正在进行',frmDataPool.qry需要做的事);
    end;
    
    procedure TForm3.N27Click(Sender: TObject);
    begin
    //右击批量修改完成状态为已完成
      TUpdateWanChengState.updatewanchengstate('已完成',frmDataPool.qry需要做的事);
    end;
    
    procedure TForm3.N28Click(Sender: TObject);
    begin
    //右击批量修改完成状态为已延期
      TUpdateWanChengState.updatewanchengstate('已延期',frmDataPool.qry需要做的事);
    end;
  • 相关阅读:
    PHP递归函数
    php算法
    php 设计模式
    TP5与TP3.X对比
    TP中U配置使用及CRUD
    smarty
    javascript运行机制之执行顺序详解
    让nodeJS支持ES6的词法----babel的安装和使用
    node.js + express 初体验【hello world】
    GIT-查看config配置信息
  • 原文地址:https://www.cnblogs.com/ddxxxb/p/7070340.html
Copyright © 2020-2023  润新知