zoukankan      html  css  js  c++  java
  • delphi --批量添加

    公共批量添加方法

    function BatchSQL(DC : TADOConnection; Qry : TADOQuery; StrSQL : TStrings): Boolean;
    var
      i : integer;
    begin
      Try
        DC.BeginTrans;
        For i := 0 to StrSQL.Count - 1 do
        begin
          With Qry do
          begin
            SQL.Clear;
            SQL.Add(StrSQL[i]);
            Try
              ExecSQL;
              Result := True;
            except
              Result := False;
            end;
          end;
        end;
        DC.CommitTrans;
        Result := True;
      except
        DC.RollbackTrans;
        Result := False;
      end;
    end;
    var 
    
     
    
    tbSql : TStrings;
    
     
    
    tbSql := TStringList.Create;
    with DMW_Public.DQ_Pub do
    begin
      while not Eof do
      begin
        spub_item_content_id:=FieldByName('pub_item_content_id').AsString;
        sInsertXConent:=' insert into set_contents(pub_line_id,pub_item_content_id) '
                +' values ('''+cbb_lines.KeyItems[cbb_lines.ItemIndex]+''','''+spub_item_content_id+''') ';
        tbSql.add(sInsertXConent);
        Next;
      end;
      try
        if BatchSQL(DMW_Public.DC_Pub,DMW_Public.DQ_Pub,tbSql) then
        begin
          ShowErrMsg('配置成功!');
        end else
        begin
          ShowErrMsg('配置失败!');
        end;
      finally
        tbSql.Free;
      end;
    end;
  • 相关阅读:
    我是怎么找到电子书的

    task1
    centos7 部署 nginx+tomcat+MariaDB 环境并安装安全狗,使用natapp隧道
    CentOS 7.0 使用 yum 安装 MariaDB 与 MariaDB 的简单配置
    mysql 配置 root 远程访问
    tomcat 配置 https 证书
    how2j 的shiro教程初探
    springboot 设置 session 过期时间
    mybatis 异常 too many connections 解决方案 mysql
  • 原文地址:https://www.cnblogs.com/michellexiaoqi/p/7908028.html
Copyright © 2011-2022 走看看