开发者

Connection Manager in Script Component

How will we 开发者_如何学编程use Connection Manager in Script component, using OLEDB Provider ? I had tried using Connection Manager with OLEDB Provider and SQL, but failed. what is the correct way to use ?


The syntax is different between a Script Task and a Script Component. Check out this article for more than a couple side-by-side comparisons:

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


This is well documented on MSDN, covering both VB and C# type of scripts: http://msdn.microsoft.com/en-us/library/ms136018.aspx


    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();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜