Solved

Converting a line of C# to VB.NET

Posted on 2006-11-29
3
210 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

752 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