Conversion failed when converting the varchar value to data type int

  • Hello..I am using a Script component as a source in my DFT..Component contains the following code

    public override void CreateNewOutputRows()

    {

    System.Windows.Forms.MessageBox.Show("Inside CreateNewOutputRows: ");

    while (sqlReader.Read())

    {

    System.Windows.Forms.MessageBox.Show("Inside CreateNewOutputRows1: ");

    {

    Output0Buffer.AddRow();

    Output0Buffer.TAG = sqlReader.GetString(0);

    }

    }

    }

    While executing the package..I am getting the following error..'Conversion failed when converting the varchar value xyz to data type int'..I am thinking that this error is caused at the line sqlReader.Read()) as the first message box is showing up properly and then the error occurs..now my query is fine..the value XYZ is also correct..the output column TAG is string as well..then can anyone tell me why it is trying to convert varchar into int??

  • rockstar283 (4/2/2012)


    Hello..I am using a Script component as a source in my DFT..Component contains the following code

    public override void CreateNewOutputRows()

    {

    System.Windows.Forms.MessageBox.Show("Inside CreateNewOutputRows: ");

    while (sqlReader.Read())

    {

    System.Windows.Forms.MessageBox.Show("Inside CreateNewOutputRows1: ");

    {

    Output0Buffer.AddRow();

    Output0Buffer.TAG = sqlReader.GetString(0);

    }

    }

    }

    While executing the package..I am getting the following error..'Conversion failed when converting the varchar value xyz to data type int'..I am thinking that this error is caused at the line sqlReader.Read()) as the first message box is showing up properly and then the error occurs..now my query is fine..the value XYZ is also correct..the output column TAG is string as well..then can anyone tell me why it is trying to convert varchar into int??

    Find where it tries to convert varchar into int data type with the help of break point....

    Thanks,
    Charmer

  • Charmer (4/6/2012)


    Find where it tries to convert varchar into int data type with the help of break point....

    You cannot debug a script component using breakpoints, unless SSIS 2012 is used.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • Koen Verbeeck (4/10/2012)


    Charmer (4/6/2012)


    Find where it tries to convert varchar into int data type with the help of break point....

    You cannot debug a script component using breakpoints, unless SSIS 2012 is used.

    Oopss...sorry about that Koen..

    Thanks,
    Charmer

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

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