• 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.

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.