2,497
社区成员
发帖
与我相关
我的任务
分享
function ExecSQL(SQLList: TStringList): Boolean;
var
ZQuery: TZQuery;
begin
Result := True;
ZQuery := TZQuery.Create(nil);
try
try
ZQuery.Connection := ZConn;
for I:=0 to SQLList.Count-1 do
begin
ZQuery.SQL.Clear;
ZQuery.SQL.Add(SQLList.Strings[I]);
ZQuery.ExecSQL;
end;
ZConn.Commit;
except
Result := False;
ZConn.Rollback;
end;
finally
FreeAndNil(ZQuery);
end;
end;
function ExecSQL(SQLList: TStringList): Boolean;
var
ZQuery: TZQuery;
begin
Result := True;
ZQuery := TZQuery.Create(nil);
try
try
ZConn.StartTranction;
ZQuery.Connection := ZConn;
for I:=0 to SQLList.Count-1 do
begin
ZQuery.SQL.Clear;
ZQuery.SQL.Add(SQLList.Strings[I]);
ZQuery.ExecSQL;
end;
ZConn.Commit;
except
Result := False;
ZConn.Rollback;
end;
finally
FreeAndNil(ZQuery);
end;
end;