zoukankan      html  css  js  c++  java
  • 修改优先级(类写法)

    定义类:

    unit UUpdateYouXianJi;
    
    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 TUpdateYouXianJi = class
      public
      class procedure updateyouxianjiselected(const SValue: string; var SAdq: TADOQuery);
    end;
    
    implementation
    
    uses FDataPool, 日常管理助手;
    class procedure TUpdateYouXianJi.updateyouxianjiselected(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
      SQL.Text:='UPDATE '+SBiao+' SET 优先级 = '+SValue.QuotedString+' WHERE 选中 = true';
      ExecSQL;
     end;
     //防止程序假死
     Application.ProcessMessages;
     //刷新纪录
     SAdq.Requery();
    finally
      SAdoq.Free;
    end;
    end;
    
    end.

    类实现应用:

    注意添加引用类的单元名UUpdateYouXianJi

    procedure TForm3.N29Click(Sender: TObject);
    begin
      //批量更新优先级为高
      TUpdateYouXianJi.updateyouxianjiselected('',frmDataPool.qry需要做的事);
    end;
    
    
    procedure TForm3.N30Click(Sender: TObject);
    begin
    //批量修改为普通
    TUpdateYouXianJi.updateyouxianjiselected('普通',frmDataPool.qry需要做的事);
    end;
    procedure TForm3.N31Click(Sender: TObject);
    begin
    //批量修改为低
    TUpdateYouXianJi.updateyouxianjiselected('',frmDataPool.qry需要做的事);
    end;
  • 相关阅读:
    Authentication for the REST APIs
    Authentication for the REST APIs
    泛型转Datatable
    Web API 返回json文件的2中不用方式
    Robotframework自定义关键字库
    python通过接口上传图片造测试数据
    robot framework(2) 环境搭建
    RobotFrameWork(1) 关键字驱动测试框架
    python发送带附件的邮件
    解决adb连接海马玩模拟器
  • 原文地址:https://www.cnblogs.com/ddxxxb/p/7070474.html
Copyright © 2011-2022 走看看