Database Reference
In-Depth Information
The CreateNewOutputRows method does the majority of the script's work. It
is responsible for extracting data from our source document and outputting it to the
data flow. The code that goes in here will depend on which pattern you select.
Finally, the ReleaseConnection method will release the file connection, indic-
ating to the runtime that we are finished with it.
Note Although you don't need to call ReleaseConnection for a file connection
manager, it's good to get into the habit of calling ReleaseConnection anytime you
have a matching call to AcquireConnection . Certain connection managers, such as
the OLE DB connection manager, will leave the underlying database connections open
and keep resources in memory until the connection object has been released.
Listing 9-6 shows the code that we will be using for both script component pat-
terns.
Listing 9-6 . Full Source Code Listing
using System;
using System.Data;
using Microsoft.SqlServer.Dts.Pipeline.Wrapper;
using Microsoft.SqlServer.Dts.Runtime.Wrapper;
using System.IO;
using System.Xml.Serialization;
using System.Xml;
[Microsoft.SqlServer.Dts.Pipeline.SSISScriptComponentEntryPointAttribute]
public class ScriptMain : UserComponent
{
string pathToXmlFile;
public override void AcquireConnections(object
Transaction)
{
// Call the base class
base.AcquireConnections(Transaction);
// The file connection manager's
 
 
Search WWH ::




Custom Search