Re: Automating DTS conversion?



function ExecDTS(const PackageName: String): Boolean;
var
pVarHost: OleVariant;
EmptyStr: OleVariant;
pkg: OleVariant;
begin
pkg := CreateOLEObject('DTS.Package');
EmptyStr := WideString('');
pkg.LoadFromSQLServer('yourserver', 'userID',
'Password', 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;

Thank you Eddie. That works!

Question, when executing the DTS Package, the app freezes. Is there any way
to get status updates from the DTS package like Enterprise Manager? Maybe a
count of records so far etc? I'd even settle for it being able to slip in a
ProcessMessages once and a while so my app doesn't appear catatonic. Some
of the transfers can take 20 minutes to run.

Cheers, and THANKS AGAIN!

John


.