Solved

Converting a line of C# to VB.NET

Posted on 2006-11-29
3
208 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
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…

823 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