在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
公共批量添加方法
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;
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论