C # access to SSIS package

Source: Internet
Author: User
Tags ssis

Typically, when you do BI or data integration, you use the SQL Job to invoke the SSIS package, but sometimes you need to program to execute the package.

There are three ways to deploy SSIS packages: file deployment, SQL Server directory, and database.

How does a variety of graphics in the Java game come true? Hibernate query question Java producer consumer where is GDI + do the small game (code)? Java thread problems Okay, can I add a background color to the RichEdit specified area? Hwnd_broadcast dead SendMessage not out of the recursive function in reverse order output the 10 elements in the array, the main () of the line statement why does not work? ~~~~... How does GDI + solve flicker problems? Emergency!! How does a double digit type retain a decimal digit? Linear quadtree Encoding How do you compare such two strings as equal? There is no code in the SYS driver to implement TCP communication, for a, thank you! Who has Unicode UCS-4 Chinese character code for 4byte that kind of Please master help me to judge, if the equation is equal, why? The main reason is why, please explain. ... The problem of the class to ask for a SQL writing I would like to know what I really need to work in the future of the technology uploaded to the server in the Word document Chinese file name read out after garbled? Weak weak to ask about picture splitting problem! Technology RSS list Lotus-like Frog Lotus leaves into a delicious twist-fried oil method spicy bean seed beef fillet potato boiled water chestnut daily a melon dish, the body is superb weekly to the dish board disinfection Meimei's heart beautiful food beauty culture words pigskin beauty medicinal food into the refrigerator how to protect healthy food skillfully "separated" hot American hand grab mutton rice and drop soup The method of storage of radish radish lotus seed ice food

How files are deployed

using DTS = Microsoft.SqlServer.Dts.Runtime;
using System.Collections;
using System.Collection.Generic;

DTS.Package dtsPackage = null;
DTS.Application dtsApplication = null;

dtsApplication = new DTS.Application();
//指定文件路径加载 package 
dtsPackage = dtsApplication.LoadPackage(@"c:\Package.dtsx", null);
DTS.Variables packageVariables1 = dtsPackage.Variables;
packageVariables1["FirstVar"].Value = "12345321"; //传递参数 
packageVariables1["SecondVar"].Value = "2312";

DTS.DTSExecResult packageResult = dtsPackage.Execute();

SQL Server Directory

string p = @"C:\Package.dtsx";

// 1 判断 package 是否存在
Boolean folderExists = app.FolderExistsOnSqlServer("myNewFolder1", ".", null, null);
Console.WriteLine("Folder exists? {0}", folderExists);

// 2 加载 package
DtsPackage.Package pkg = app.LoadFromSqlServer("newPkg", ".", String.Empty, String.Empty, null);
DtsPackage.Variables vars2 = pkg.Variables;
vars2["OpeId"].Value = "value from c#";
DtsPackage.DTSExecResult result2 = pkg.Execute();

//3 删除包
app.RemoveFolderFromSqlServer("myNewFolder1", ".", null, null);
folderExists = app.FolderExistsOnSqlServer("myNewFolder1", ".", null, null);
Console.WriteLine("Folder exists? {0}", folderExists);

Database: On the way of the database, currently has not been applied, in the future, if the test after the completion of a complete supplement.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.