Solved

Converting a line of C# to VB.NET

Posted on 2006-11-29
3
209 Views
Last Modified: 2012-06-27
Friends,

I have code here that was converted from C# To VB.NET, with the exception of a single line.

What this code does is, it takes the defined SSISPackage and executes it.  Great, except that now I want to execute it after setting the value of a user defined Variable.  Now, without the extra line, it executes and transfers the data that meets the criteria, but I want to be able to change that criteria by changing the variable value.

So, to make this work, can someone please convert the line to VB.NET.  I've tried, but I don't know enough about this SSIS stuff to make it work.
Thanks!

        Dim app As Microsoft.SqlServer.Dts.Runtime.Application
        app = New Microsoft.SqlServer.Dts.Runtime.Application
        Dim pkgResults_Sql As DTSExecResult
        Dim pkgErrors As DtsErrors
        Dim pkgWarnings As DtsWarnings

        Dim SSISPackage As String = "TestPreambleExport"

        Dim pkgIn As Package = New Package
       pkgIn = app.LoadFromSqlServer("\\" + SSISPackage, "SQLServerName", "UserName", "Password", Nothing)

        'pkg.Variables["PreamblePass"].Value = "R.I";  <-!!!!!!!!!!!!! this is the line I need to convert.!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
        'Also, in the example I got this from, pkg was not defined, so what does it need to be defined as???

        pkgResults_Sql = pkgIn.Execute()
0
Comment
Question by:indy500fan
  • 2
3 Comments
 
LVL 44

Accepted Solution

by:
Arthur_Wood earned 500 total points
ID: 18038586
my guess would be that the example you were looking at had a TYPO, and this code should read:

pkgIn.Variables["PreamblePass"].Value = "R.I"  

see if that works.

AW
0
 

Author Comment

by:indy500fan
ID: 18038611
AW,

Well, that's what I would have orginially thought to do, but when I do that I get two errors:

Error      1      Property access must assign to the property or use its value.      
The whole line is underlined.

Error      2      Identifier expected.      
When I double-click on the error, it highlights the first double-quote, before PreamblePass

0
 

Author Comment

by:indy500fan
ID: 18038729
This should work:

pkgIn.Variables("PreamblePass").Value = "R.I"
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question