Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8349281
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T07:56:46+00:00 2026-06-09T07:56:46+00:00

Inside of a Script Task in SSIS, I need to make a call to

  • 0

Inside of a Script Task in SSIS, I need to make a call to an SQL database. I have a connection string that was created when I added the database to the data sources folder, however now I’m not sure how to reference it inside the C# code. I know how to do this in the code behind of an ASP website, however it seems that SSIS should have a more direct method.

EDIT

This line of code actually winds up throwing an exception:

sqlConn = (System.Data.SqlClient.SqlConnection)cm.AcquireConnection(Dts.Transaction);

It reads: “Unable to cast COM object of type ‘System._ComObject’ to class type ‘System.Data.SqlClient.SqlConection.'”

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T07:56:48+00:00Added an answer on June 9, 2026 at 7:56 am

    you cant use the configurations from a connection manager from inside a script task like:
    conectionManager1.exceuteSQLStatment(…)

    once you are “inside” the script task you need to access the CM like a variable:

    ConnectionManager cm;
    System.Data.SqlClient.SqlConnection sqlConn;
    System.Data.SqlClient.SqlCommand sqlComm;
    
    cm = Dts.Connections["conectionManager1"];
    
    sqlConn = (System.Data.SqlClient.SqlConnection)cm.AcquireConnection(Dts.Transaction);
    sqlComm = new System.Data.SqlClient.SqlCommand("your SQL Command", sqlConn);
    sqlComm.ExecuteNonQuery();
    
    cm.ReleaseConnection(sqlConn);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a script task (VB 2008) inside an SSIS dtsx package that I'm
Is there a command I can run inside my SQL script so that it
I have a function in my script that's supposed to take in a string
I have a package which contains a Script task. Inside we are calling one
Im working inside a SSIS package. I have some C# script for placing Table
I have an SSIS package that imports Excel files. Inside the package, I have
i have written a oracle query in Script Task and assigned it to string
I need help getting VIM to correctly indent javascript inside script tags. This is
I have a function defined inside the script tags of head.(in a JSP) I
I was wondering how to handle errors inside a script that is meant to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.