none
WCF- SQL adapter Format exception Issue RRS feed

  • Question

  • Hi,

    i am using WCF-SQL adapter to fetch values from SQL server.

    One field has Bit in SP input so in BizTalk schema it created as Boolean. the boolean value is not accepted by the StoredPorcedure because the boolean value passed is "True /False", the SP input will accept only "0/1". So i have chnaged the Boolean to Int in Both BizTalk Schema and SP input.

    With the above changes the code is working in 2 environment, while i am deploy the same code in another environment i am facing the below error.

    "System.FormatException: Failed to convert parameter value from a String to a Boolean. ---> System.FormatException: String was not recognized as a valid Boolean.
       at System.Boolean.Parse(String value)
       at System.String.System.IConvertible.ToBoolean(IFormatProvider provider)
       at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
       at System.Data.SqlClient.SqlParameter.CoerceValue(Object value, MetaType destinationType)
       --- End of inner exception stack trace ---"

    I am not sure why it is throwing this error.It is due to some dll missing or some other issue. if anybody faced the same issue please help me to resolve this issue.

    Thanks,

    Aboorva Raja


    Aboorva Raja R

    Monday, October 8, 2012 1:24 PM

Answers

All replies

  • Changing a Schema from one type to another will not change any values!! You need to map True->1 and False->0

    Morten la Cour

    Monday, October 8, 2012 1:31 PM
  • Hi Morten,

    I am having similar issue. Could you please elaborate your answer?

    Sandy

    Wednesday, January 25, 2017 4:46 PM
  • Hello Sandeep, 

    If you see Op mentions

    “One field has Bit in SP input so in BizTalk schema it created as Boolean. the boolean value is not accepted by the StoredPorcedure because the boolean value passed is "True /False", the SP input will accept only "0/1". 

    The BizTalk schema for the SP (which you will use to pass the message to SQL SP ) has a field Boolean , however you will not pass true/false. In your map (of in your expression shape) which you are using to create the message for SP , while assigning the Boolean field, assign 0 for true and 1 for false.  

    In summary, change the values in the message which is going to SP because SP only accepts bit (0/1), and its failing because you are passing true/false.

    Please let us know if you need mode details. 

    Thanks


    Cheers,HTH

    Naushad Alam http://alamnaushad.wordpress.com/

    When you see answers and helpful posts, please click Vote As Helpful , Propose As Answer , and/or Mark As Answer

    Thursday, January 26, 2017 3:14 PM