Home > Database > Mysql Tutorial > body text

VS2005运行ssis包(vs2008,sql2008)

WBOY
Release: 2016-06-07 15:09:41
Original
1120 people have browsed it

首先, 引用 10.0.0 .0 版本 dll ,如下: add assembly="Microsoft.SqlServer.Dts.Design, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91"/ add assembly="Microsoft.SqlServer.DTSPipelineWrap, Version=10.0.0.0, Culture=neutral

首先,引用10.0.0.0版本dll,如下:


 

using Microsoft.SqlServer.Dts.Runtime.Wrapper;

 

代码如下:

public int ExecuteSSASDts()
    {
        string filepath = urlconvertorlocal("Package.dtsx");
        if (!System.IO.File.Exists(filepath))
        {
            return 2;
        }
        // Call SSIS package from SQL Server.
        Application application = new ApplicationClass();       
        IDTSPackage100 package = application.LoadPackage(filepath,false,null);

        DTSExecResult result = package.Execute();
        if (result.Equals(DTSExecResult.DTSER_SUCCESS))
        {
            return 1;
        }
        else
        {
            return 0;
        }
    }
//相对路径转换成服务器本地物理路径
private string urlconvertorlocal(string imagesurl1)
    {
        string tmpRootDir = Server.MapPath(System.Web.HttpContext.Current.Request.ApplicationPath.ToString());//获取程序根目录
        string imagesurl2 = tmpRootDir + "//Dashboard//" + imagesurl1.Replace(@"/", @"/"); //转换成绝对路径
         return imagesurl2;
     }


这个问题困扰了我好久,现发出来与大家共享,希望能给一些想我一样的菜鸟一些帮助

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template