公共批量添加方法

function BatchSQL(DC : TADOConnection; Qry : TADOQuery; StrSQL : TStrings): Boolean;
var
  i : integer;
begin
  Try
    DC.BeginTrans;
    For i := to StrSQL.Count - 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;

最新文章

  1. PHP XML和数组互相转换
  2. UpdatePanel 中 导出Excel按钮
  3. hdu 1078 FatMouse and Cheese
  4. java.util.TreeMap源码分析
  5. jdk1.8.0_101/bin下各文件解释
  6. js--小结①
  7. 纪录一个table元素里面的tr th td
  8. QT程序启动界面的使用
  9. onclick=‘’return false“
  10. Vijos 1011 清帝之惑之顺治 记忆录式的动态规划(记忆化搜索)
  11. 50. leetcode 520. Detect Capital
  12. VPS搭建离线下载服务器——后网盘时代
  13. PS 滤镜——平面坐标变换到极坐标
  14. 【window】window10永久关闭更新
  15. 辽宁移动宽带体验及魔百盒M101s-2刷机
  16. 免费CDN公共库——网站提速 静态资源库
  17. mysql root情况
  18. Python学习-41.Python中的断言
  19. 【poj2411】 Mondriaan's Dream
  20. SVN代理设置

热门文章

  1. MongoDB - Cursors
  2. A Translation for Quaternion 一篇对四元数的翻译
  3. linux下Samba服务配置
  4. PHPCMS v9.6.0后台getshell
  5. session用户账号认证(一个用户登陆,踢出前一个用户)
  6. ORACLE完整安装过程
  7. 宝宝书 & 网站
  8. 一句话搞定IOS中View的Frame和Bound
  9. 数据挖据之GeoHash核心原理解析
  10. js禁止别人查看源码