脚本组件中的连接管理器

时间:2010-08-04 07:30:15

标签: ssis

我们如何使用OLEDB Provider在Script组件中使用Connection Manager?我曾尝试将Connection Manager与OLEDB Provider和SQL一起使用,但失败了。什么是正确的使用方式?

3 个答案:

答案 0 :(得分:4)

MSDN上有详细记载,包括VB和C#类型的脚本:http://msdn.microsoft.com/en-us/library/ms136018.aspx

答案 1 :(得分:4)

脚本任务和脚本组件之间的语法不同。查看这篇文章不仅仅是几个并排的比较:

http://msdn.microsoft.com/en-us/library/ms136031.aspx

答案 2 :(得分:0)

    IDTSConnectionManager100 connMgr = this.Connections.ADONetAppStaging ; //this we need to give name in connection manager in script component

    SqlConnection myADONETConnection = new SqlConnection();

    myADONETConnection = (SqlConnection)(connMgr.AcquireConnection(null));


    //Read data from table or view to data table
    string query = "Select top 10 * From ##AP_Stagging_Temp_ExportWODuplicates Order by 1,2,3 asc ";
   // string query = "Select  * From ##AP_Stagging_Temp_For_JLL_ExportWODuplicates order by 1,2,3 asc ";
    SqlDataAdapter adapter = new SqlDataAdapter(query, myADONETConnection);

DataTable dtExcelData = new DataTable();
    adapter.Fill(dtExcelData);
    myADONETConnection.Close();