Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error with Custom Component

Status
Not open for further replies.

HappyProgrammer

Programmer
Oct 15, 2003
4
US
I have written a script task which does the following:

1. Queries a table and returns a list of variable names and values. It uses the same table regardless of where it is being run from.

2. Loops through existing user variables and if a match is found with the results in step 1 it will assign the value from the table to the variable.

The method it is using to get and set the name of the variables is Dts.Variables({Insert Variable Name Here}).Value which works fine when the code is being run as a script task in SSIS package but when trying to develop a custom component I get the error "Name 'dts' is not declared". I understand what the error means but am unsure how to get rid of it. Is there a way to ignore build errors or a different way to reference the package that this component will be running in?

I can post code if necessary. Any help will be appreciated.

Thanks
 
Did you create a reference to the proper assemblies that contain the dts elements?

A custom component at the code level doesn't know that it is a SSIS task and what items need to be referenced. It is just another chunk of code you have written and compiled.
 
Thank you for your response MDXer.

It appears that the DTS object model is part of the Microsoft.SQLServer.DTSRuntimeWrap assembly which I added a reference to.

From what I have been reading it seems I may have to load the package and assign it to a variable named dts or some name like that which should give me access to it's properties. The problem is that that still requires the name of the package. I would assume this would be known somehow since the component will be dragged onto a particular package. I may be way off base on this but I'm not sure how to do this.

My intent for all this is to make this component available to other developers who would like to have a way of dynamically assigning values to variables using the method in original post. Maybe custom component isn't the best way to do this?

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top