Solved

Converting a line of C# to VB.NET

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Sort Datagrdview programmatically 19 36
Library to convert HTML to PDF. 8 46
Clone Visual studio 2013 solution 5 17
Create XML 5 35
I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

743 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now