Android smartphone

2009-10-22

Run SQL package by delphi

Author :Freiend 88

Example: The function use to calling package of SQL server.

function ExecDTS(const PackageName: String): Boolean;
var
pVarHost: OleVariant;
EmptyStr: OleVariant;
pkg: OleVariant;
i:integer;
begin
pkg := CreateOLEObject('DTS.Package');
EmptyStr := WideString('');
pkg.LoadFromSQLServer(fservername,
fusername,
fpassword,
0,
EmptyStr,
EmptyStr,
EmptyStr,
WideString(PackageName),
pVarHost);
pkg.FailOnError := True;
for i := 1 to pkg.Steps.Count do
pkg.Steps.Item(i).ExecuteInMainThread := True;
pkg.Execute;
Result := True;
pkg.UnInitialize;
end;

No comments: