adoquery处理多条SQL语句

来源:互联网 发布:网络格斗游戏大全 编辑:程序博客网 时间:2024/05/22 04:21

http://topic.csdn.net/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了!

原创粉丝点击