Error Converting bit to xs:boolean

  • Thread starter Thread starter SJ
  • Start date Start date
S

SJ

Hi,

This problem has only just started occuring, in code that had not changed!
I have a bit field in the database, and am using SQLXML to retrieve data and
fill a strongly typed dataset. The (auto-generated) XDR for the dataset
includes this mapping to the bit field:

<xs:element name="blnAreUrlsRelative" type="xs:boolean" minOccurs="0" />

When I run this, though, I get the following error:

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.ToBoolean(Object value) at
System.Data.Common.BooleanStorage.Set(Int32 record, Object value) at
System.Data.DataColumn.set_Item(Int32 record, Boolean fConvertNull, Object
value)Couldn't store <1> in blnAreUrlsRelative Column. Expected type is
Boolean.

The bit field is not nullable. The SP returns XML using the FOR XML AUTO
clause. I've checked the XML and it looks fine.

Does anyone have any ideas what could be the problem?

Thanks

Simon
 
This may sound like its coming out of left field but is there a primary key on the table? Is it being included in the dataset? (I saw only one thing that read like yours and it involved
keys so it's worth asking about<G>)

You mentioned no Code changes, Have you installed ANYTHING (Service packs, updates, new software, coffee maker) since the last time it is known to have worked? Can you
recreate the problem in a small project? If so send it to me to take a look at..

Want to know more? Check out the MSDN Library at http://msdn.microsoft.com or the Microsoft Knowledge Base at http://support.microsoft.com

Scot Rose, MCSD
Microsoft Visual Basic Developer Support
Email : (e-mail address removed) <Remove word online. from address>

This posting is provided “AS IS”, with no warranties, and confers no rights.




--------------------
 
Back
Top