Script Task to open database connection and write to it

  • I am looking for example on how to open database conn and write to it in Script Task.

  • For a simple data flow operation, you don't need to script it; you can use the OleDB Destination to write data to your SQL Server database.

    hth,

    Tim

  • I have script task that does data validation and manipulation using custom dll's and i need to store data into database after data validation. It has to be in script task. I just need to insert data into database in Script Task.

  • One option is to:

    1. Create an ADO.NET Connection Manager named "MySQLConnMgr"

    2. In your Script Task have something like:

    Dim oConn As System.Data.SqlClient.SqlConnection = DirectCast(Dts.Connections("MySQLConnMgr").AcquireConnection(Nothing), System.Data.SqlClient.SqlConnection)

    'TODO: Use the connection

    If oConn IsNot Nothing Then

    Dts.Connections("MySQLConnMgr").ReleaseConnection(Nothing)

    End If

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply