http://topic.youkuaiyun.com/u/20090317/16/288c8072-020c-466c-803b-24c8704d5dea.html?seed=1335842558
Delphi(Pascal) code
var
sqlStr:String;
begin
sqlStr:= ' begin '
sqlStr:= sqlStr+ 'update table1 set col1 = ''test'' where 1=2;';
sqlStr:= sqlStr+ 'update table1 set col1 = ''test2'' where 1=2;';
sqlStr:= sqlStr+ ' end ';
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add(sqlStr);
adoquery1.ExecSQL;
end;
把sql语句用begin...end包起來,再提交給DB处理,就OK了!
本文介绍了一种使用Delphi(Pascal)批量执行多个SQL更新语句的方法。通过将多条更新语句包裹在begin...end中并利用ADOQuery组件进行执行。此方法适用于需要一次提交多个SQL更改的场景。
1224

被折叠的 条评论
为什么被折叠?



