• 全不选


    方法1:单击事件写法:

    procedure TForm3.N9Click(Sender: TObject);
    
     begin
     with frmDataPool.qry需要做的事 do
     begin
     Close;
     SQL.Text :='UPDATE 需要做的事 SET 选中 = 0';
     ExecSQL;
     end;
         //防止程序假死
     // Application.ProcessMessages;
    //  //刷新下显示
    // with sAqry do
    // begin
    // Close;
    // SQL.Text :='select * from ' + SBiao ;
    // Open;
    // end;
    TInitializeDatabaseAdoSqlApi.accessAdoToSql(frmDataPool.qry需要做的事);
     end;

    方法2:类写法:

    unit UUnSelectAll;
    
    interface
    uses  FDataPool, Data.DB, Data.Win.ADODB, Vcl.Menus,  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
      Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ComCtrls,
      Vcl.ExtCtrls, Vcl.DBCtrls, Vcl.Grids, Vcl.DBGrids, Clipbrd,
      Vcl.StdCtrls;
    /// <summary>
    /// 全选更新所有记录选中值为0
    /// </summary>
    type TUnSeleteAll=class
     public
     class procedure unSelectAllRecord (var sAqry:TADOQuery);
    end;
    implementation
    uses 日常管理助手, UInitializeDatabaseAdoSqlApi;
     class procedure TUnSeleteAll.unSelectAllRecord(var sAqry:TADOQuery);
     var
     SBiao: string;
     begin
     SBiao:=copy(sAqry.name,4,length(sAqry.name)-3);
     with sAqry do
     begin
     Close;
     SQL.Text :='UPDATE ' + SBiao + ' SET 选中 = 0';
     ExecSQL;
     end;
         //防止程序假死
     Application.ProcessMessages;
    //  //刷新下显示
    // with sAqry do
    // begin
    // Close;
    // SQL.Text :='select * from ' + SBiao ;
    // Open;
    // end;
    TInitializeDatabaseAdoSqlApi.accessAdoToSql(sAqry);
     end;
    end.

    类引用:注意别忘记uses语句中添加引用类的单元名;(uses UUnSelectAll ;)

    procedure TForm3.N9Click(Sender: TObject);
    begin
    TUnSeleteAll.unSelectAllRecord(frmDataPool.qry需要做的事);//全不选记录,更改选中列为0
    
    end;
  • 相关阅读:
    快速排序
    归并排序
    堆排序
    通过先序和中序创建二叉树
    插入排序
    二叉排序树
    九宫重排
    字符串匹配 sunday算法
    傻逼数学题(math)
    最近点对学习笔记
  • 原文地址:https://www.cnblogs.com/ddxxxb/p/7061350.html
Copyright © 2020-2023  润新知