BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Re: adding steps/tasks/connections to a DTS package

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (SQL Servers)
View previous topic :: View next topic  
Author Message
J O Holloway
Guest





PostPosted: Wed Aug 13, 2003 4:43 pm    Post subject: Re: adding steps/tasks/connections to a DTS package Reply with quote



Nevermind, I see it now.

Here's an example, using a pre-saved empty DTS package. It just adds an
Active X Script task, but of course from there you can edit the script or
any of the other settings. The reason a step is added (even for this
one-task package) is because without the step assigned to it a task won't
show in the UI.

FPkg := CoPackage.Create;
FPkg.LoadFromStorageFile(
'\johollowayPinnacleProductsEISRJRloyaltycardFlashFoodssql
stuffdts testTest.dts',
WideString(''), //package password
WideString(''), //package id
WideString(''), //version id
WideString('Test'), //package name
EmptyParam //pVarPersistStgOfHost
);

TheStep := FPkg.Steps.New;
TheTask := FPkg.Tasks.New('DTSActiveScriptTask');
TheTask.Set_Name('DTSTask_DTSActiveScriptTask_1');
TheTask.Set_Description('mundo');
FPkg.Tasks.Add(TheTask);
TheStep.Set_Name('StepOne');
TheStep.Set_TaskName(TheTask.Get_Name);
FPkg.Steps.Add(TheStep);

FPkg.SaveToSQLServer(
'(local)',
WideString('myUser'),
WideString('myPassword'),
DTSSQLStgFlag_Default,
WideString(''), //package owner password
WideString(''), //package operator password
WideString(''), //package category id
EmptyParam, //pVarPersistStgOfHost
TRUE //bReusePasswords
);


Back to top
J O Holloway
Guest





PostPosted: Wed Aug 13, 2003 6:33 pm    Post subject: Re: adding steps/tasks/connections to a DTS package Reply with quote



Should have specified the stuff in the var ..

procedure soandso()
var
FPkg : _Package;
cSQL : string;
TheTask : Task;
TheStep : Step;
begin
//code from previous post
end


"J O Holloway" <jholloway (AT) pinncorp (DOT) com> wrote

Quote:
Nevermind, I see it now.

Here's an example, using a pre-saved empty DTS package. It just adds an
Active X Script task, but of course from there you can edit the script or
any of the other settings. The reason a step is added (even for this
one-task package) is because without the step assigned to it a task won't
show in the UI.

FPkg := CoPackage.Create;
FPkg.LoadFromStorageFile(
'\johollowayPinnacleProductsEISRJRloyaltycardFlashFoodssql
stuffdts testTest.dts',
WideString(''), //package password
WideString(''), //package id
WideString(''), //version id
WideString('Test'), //package name
EmptyParam //pVarPersistStgOfHost
);

TheStep := FPkg.Steps.New;
TheTask := FPkg.Tasks.New('DTSActiveScriptTask');
TheTask.Set_Name('DTSTask_DTSActiveScriptTask_1');
TheTask.Set_Description('mundo');
FPkg.Tasks.Add(TheTask);
TheStep.Set_Name('StepOne');
TheStep.Set_TaskName(TheTask.Get_Name);
FPkg.Steps.Add(TheStep);

FPkg.SaveToSQLServer(
'(local)',
WideString('myUser'),
WideString('myPassword'),
DTSSQLStgFlag_Default,
WideString(''), //package owner password
WideString(''), //package operator password
WideString(''), //package category id
EmptyParam, //pVarPersistStgOfHost
TRUE //bReusePasswords
);





Back to top
Jeremy Collins
Guest





PostPosted: Thu Aug 14, 2003 10:52 am    Post subject: Re: adding steps/tasks/connections to a DTS package Reply with quote



J O Holloway wrote:

Quote:
Does anyone know how to add tasks & steps and/or connections to an existing
DTS package?

I've figured out how to modify steps/tasks/connections, and how to use DTS
jobs as either structured storage files or as packages saved to SQL Server.
As well I've figured out how to do some interesting stuff like use a DTS
package to get information about a scheduled job and modify that job's
settings. What I have not been able to figure out is how to modify a DTS
package in the sense of adding a task/step or adding connection.

Any help would be much appreciated.

Something like this maybe (I've only done DTS modification stuff in
VB)...

uses DTS_TLB;

var
pkg : Package;
cnn : Connection;
begin
pkg := CoPackage.Create;
:
cnn := pkg.Connections.New('SQLOLEDB.1');
cnn.DataSource := 'some_db_info';
:
pkg.SaveToSQLServer(...)

end;

Same with tasks I guess.


--
jc


Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (SQL Servers) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.