dbTalk Databases Forums  

DTS Package using c#

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss DTS Package using c# in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
TheBigJ
 
Posts: n/a

Default DTS Package using c# - 04-25-2006 , 09:21 AM






This is what I need the DTS package to do:
I need to create a temp table, import the contents of a text file, add
some info to the temp table (done with stored procedures) and then add
the contents of the temp table to the permanent table and drop the temp
table.
I created the DTS package in Enterprise Manager and will be calling it
from a c# program.
In the c# program I set a global variable to be the file name without
the file extension (the file name will be the customer identifier and
is added to the temp table after the text file is imported) The reason
I need to use a temp table is because I may have more then one instance
of the DTS package running at one time for different customers and need
to make sure the info does not get crossed.
With the way the DTS package is currently set up, the temp table name
is #tmpGLOBALVARIABLE. I will know the name of the temp table when the
DTS package is called, but do not know how to change the transform data
task properties to load to the temp table. The temp table has the same
structure as the permanent table, so the transformations will already
be set, I just need to change the destination table in the c# program
before I execute the package.
Any ideas of how I can this, or where I may be able to look to find
information on this?


Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: DTS Package using c# - 04-25-2006 , 08:04 PM






Hello TheBigJ,

OK So you want to chnage the

DestinationObjectName property of the DataPump task


In an Active Script task I would do this


dim tsk ,

SET tsk = DTSGlobalVariables.Parent.Task("Name").CustomTask

tsk.DestinationObjectName ="XXX"


Have a look at these

http://www.developersdex.com/csharp/...egroups.com%3E

And

http://sqldev.net/DTS/dotnetcookbook.htm


Allan Mitchell
www.SQLDTS.com
www.SQLIS.com
www.Konesans.com

Quote:
This is what I need the DTS package to do:
I need to create a temp table, import the contents of a text file, add
some info to the temp table (done with stored procedures) and then add
the contents of the temp table to the permanent table and drop the
temp
table.
I created the DTS package in Enterprise Manager and will be calling it
from a c# program.
In the c# program I set a global variable to be the file name without
the file extension (the file name will be the customer identifier and
is added to the temp table after the text file is imported) The reason
I need to use a temp table is because I may have more then one
instance
of the DTS package running at one time for different customers and
need
to make sure the info does not get crossed.
With the way the DTS package is currently set up, the temp table name
is #tmpGLOBALVARIABLE. I will know the name of the temp table when the
DTS package is called, but do not know how to change the transform
data
task properties to load to the temp table. The temp table has the same
structure as the permanent table, so the transformations will already
be set, I just need to change the destination table in the c# program
before I execute the package.
Any ideas of how I can this, or where I may be able to look to find
information on this?



Reply With Quote
  #3  
Old   
TheBigJ
 
Posts: n/a

Default Re: DTS Package using c# - 04-26-2006 , 03:12 PM



Thank you so much, I am a lot closer BUT now I am getting an error
message:

oDataPump = (DTS.DataPumpTask2)oTask.CustomTask;-->error Message
occures here
----> Error Message is: "QueryInterface for interface DTS.CustomTask
failed."

I read all over the place that the fix to this in in SP2.
Our sql server machine is using service pack 4, so no problem there.
I know that SP2 needs to be on the client machine also, how do I
determine what version the client machine is running?


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.