I am using Foreach ADO enumerator that brings back a small amount claim id's into a data flow. I then run those claims id's in the script component below which is a datasource. Each claim can have from 0 to 5 rows of data. it works find for zero and one row of data. It doesn't work for multiple rows of data. See Script below - I am probably doing something wrong in the CreateNewOutputRows section.
I get the following error when it runs into a claim with multiple rows. It writes the first row to the distinction - and then stops.
I don't believe this is actual error - since there are no columns set to Int32
at Microsoft.SqlServer.Dts.Pipeline.Wrapper.IDTSBuffer100.AddRow(IntPtr ppRowStart)
at Microsoft.SqlServer.Dts.Pipeline.PipelineBuffer.AddRow()
at ScriptMain.CreateNewOutputRows()
at UserComponent.PrimeOutput(Int32 Outputs, Int32[] OutputIDs, PipelineBuffer[] Buffers, OutputNameMap OutputMap)
at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.PrimeOutput(Int32 outputs, Int32[] outputIDs, PipelineBuffer[] buffers)
Script is below
using System;
using System.Data;
using Microsoft.SqlServer.Dts.Pipeline.Wrapper;
using Microsoft.SqlServer.Dts.Runtime.Wrapper;
using Microsoft.SqlServer.Dts.Runtime;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Collections.Generic;
using System.Diagnostics;
using System.Data.OracleClient;
[Microsoft.SqlServer.Dts.Pipeline.SSISScriptComponentEntryPointAttribute]
public class ScriptMain : UserComponent
{
string Claimid = string.Empty;
private IDTSConnectionManager100 connMgr;
private OracleConnection oracleConn;
private OracleCommand oracleCmd;
private OracleDataReader oracleRdr;
{
connMgr = this.Connections.ORCL;
oracleConn = (OracleConnection)connMgr.AcquireConnection(Transaction);
}
{
base.PreExecute();
/*
* Add your code here
*/
//string claimid = Convert.ToString(dts.Variables["User::ClaimID"].Value);
//this.VariableDispenser.LockForRead("User::ClaimID");
Claimid = this.Variables.ClaimID;
//MessageBox.Show (Claimid);
string sql = "SELECT CMC_SBSB_SUBSC.SBSB_ID, CMC_CLED_EDI_DATA.CLED_EXT_REF, CMC_CLED_EDI_DATA.CLED_TRAD_PARTNER, CMC_CLED_EDI_DATA.CLCL_ID, CMC_MECB_COB.MCRE_ID, CMC_MCRE_RELAT_ENT.MCRE_NAME, CMC_MECB_COB.MECB_EFF_DT, CMC_MECB_COB.MECB_TERM_DT, CMC_MECB_COB.MECB_POLICY_ID, cast(CMC_MECB_COB.MEME_CK as nvarchar2(25)) FROM fac.CMC_CLED_EDI_DATA LEFT JOIN fac.CMC_CLCL_CLAIM ON fac.CMC_CLED_EDI_DATA.CLCL_ID = fac.CMC_CLCL_CLAIM.CLCL_ID LEFT JOIN fac.CMC_SBSB_SUBSC ON fac.CMC_CLCL_CLAIM.SBSB_CK = fac.CMC_SBSB_SUBSC.SBSB_CK LEFT JOIN fac.CMC_MEME_MEMBER ON fac.CMC_SBSB_SUBSC.SBSB_CK = fac.CMC_MEME_MEMBER.SBSB_CK LEFT JOIN fac.CMC_MECB_COB ON fac.CMC_MEME_MEMBER.MEME_CK = fac.CMC_MECB_COB.MEME_CK LEFT JOIN fac.CMC_MCRE_RELAT_ENT ON fac.CMC_MECB_COB.MCRE_ID = fac.CMC_MCRE_RELAT_ENT.MCRE_ID WHERE fac.CMC_MECB_COB.MCRE_ID In ('10542', '11593', '11605', '11610', '11746', '11753', '19055', '19283', '19302', '19977', '20028', '20031', '20211', '20241', '20501', '20636', '20894', '20911', '24336', '24658', '20633', '27759', '27762', '24349') AND fac.CMC_CLED_EDI_DATA.CLCL_ID = '" + Claimid + "'";
//MessageBox.Show(sql);
oracleCmd = new OracleCommand(sql, oracleConn);
{
throw new NotImplementedException();
}
{
base.PostExecute();
/*
* Add your code here
sqlReader.Close();
*/
{
connMgr.ReleaseConnection(oracleConn);
}
public override void CreateNewOutputRows()
{
/*
Add rows by calling the AddRow method on the member variable named "<Output Name>Buffer".
For example, call MyOutputBuffer.AddRow() if your output was named "MyOutput".
*/
{
{
MyOutPutBuffer.SBSBID = oracleRdr.GetString(0);
MyOutPutBuffer.CLEDEXTREF = oracleRdr.GetString(1);
MyOutPutBuffer.CLEDTRADPARTNER = oracleRdr.GetString(2);
MyOutPutBuffer.CLCLID = oracleRdr.GetString(3);
MyOutPutBuffer.MCREID = oracleRdr.GetString(4);
MyOutPutBuffer.MCRENAME = oracleRdr.GetString(5);
MyOutPutBuffer.MECBEFFDT = oracleRdr.GetDateTime(6);
MyOutPutBuffer.MECBTERMDT = oracleRdr.GetDateTime(7);
MyOutPutBuffer.MECBPOLICYID = oracleRdr.GetString(8);
MyOutPutBuffer.MEMECK = oracleRdr.GetString(9);
}
}