June 3, 2013 at 2:42 pm
I need help trying to figure out what caused this error. I threw some Messagebox.Show in the script but they never get to appear? I'm not that familiar with scripts, I inherited this SSIS from previous developer.
Unable to cast object of type 'System.String' to type 'Microsoft.SqlServer.Dts.Pipeline.BlobColumn'.
at Input0Buffer.get_ENTR()
at ScriptMain.Input0_ProcessInputRow(Input0Buffer Row)
at UserComponent.Input0_ProcessInput(Input0Buffer Buffer)
at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.ProcessInput(Int32 inputID, PipelineBuffer buffer)
public override void Input0_ProcessInputRow(Input0Buffer Row)
{
MessageBox.Show("Processing");
agData += blobToString(Row.AG);
carlData += blobToString(Row.CARL);
fmnData += blobToString(Row.FMN);
entrData += blobToString(Row.ENTR);
}
private string blobToString(Microsoft.SqlServer.Dts.Pipeline.BlobColumn blob)
{
string result = "";
try
{
if (blob != null)
{
result = System.Text.Encoding.Unicode.GetString(blob.GetBlobData(0, Convert.ToInt32(blob.Length)));
}
}
catch (Exception ex)
{
MessageBox.Show("In the catch block" + ex);
result = ex.Message;
}
return result;
}
June 4, 2013 at 1:04 am
bobd125 (6/3/2013)
I need help trying to figure out what caused this error. I threw some Messagebox.Show in the script but they never get to appear? I'm not that familiar with scripts, I inherited this SSIS from previous developer.Unable to cast object of type 'System.String' to type 'Microsoft.SqlServer.Dts.Pipeline.BlobColumn'.
at Input0Buffer.get_ENTR()
at ScriptMain.Input0_ProcessInputRow(Input0Buffer Row)
at UserComponent.Input0_ProcessInput(Input0Buffer Buffer)
at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.ProcessInput(Int32 inputID, PipelineBuffer buffer)
public override void Input0_ProcessInputRow(Input0Buffer Row)
{
MessageBox.Show("Processing");
agData += blobToString(Row.AG);
carlData += blobToString(Row.CARL);
fmnData += blobToString(Row.FMN);
entrData += blobToString(Row.ENTR);
}
private string blobToString(Microsoft.SqlServer.Dts.Pipeline.BlobColumn blob)
{
string result = "";
try
{
if (blob != null)
{
result = System.Text.Encoding.Unicode.GetString(blob.GetBlobData(0, Convert.ToInt32(blob.Length)));
}
}
catch (Exception ex)
{
MessageBox.Show("In the catch block" + ex);
result = ex.Message;
}
return result;
}
Looks like your blobTOString() function is trying to return a string from a blob. But the error message suggests that one of the arguments to the functions is already a string.
What are the datatypes of the columns AG, CARL, FMN and ENTR? If any one of them is already string, I think that that is what would cause this.
The absence of evidence is not evidence of absence.
Martin Rees
You can lead a horse to water, but a pencil must be lead.
Stan Laurel
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply