Solved

Converting a line of C# to VB.NET

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
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…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

623 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