Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Visual Basic (Microsoft) VB.NET FAQ

XML Web Services How To

How to pass True/False value to a bound Windows Check Box by paulray
Posted: 18 Dec 03

There appears to be a problem in passing Boolean values to a Windows Form Checkbox when accessing data via XML Web Services. Note: This problem has been tested with MS-SQL 2000 but not other db's. When you generate a dataset in your web services, VB.NET creates the .xsd for you. In the case of a bit (boolean) value, DBNull is passed, not the table default (usually 0 or false). To overide this behaviour, you must update the .xsd to show a default value.
For example.
The IDE generated .xsd provides the following fields for a table we will call tblSystemMode
  <xs:element name="Mode_ID" type="xs:string" />
  <xs:element name="Description" type="xs:string" />
  <xs:element name="SYS_REC" type="xs:boolean" />

You must change the boolean field (SYS_REC) to include a default value to over-ride the DBNull value that will be passed in the above example:
  <xs:element name="Mode_ID" type="xs:string" />
  <xs:element name="Description" type="xs:string" />
  <xs:element name="SYS_REC" type="xs:boolean" default="0" />
If you don't default the boolean value, the web services will pass DBNull, and unless the user clicks the checkbox, the DBNull value will be passed back, ( and potentialy fail if Allow Nulls is set to false.
Hope this helps you in your VB.NET travels!

Back to Visual Basic (Microsoft) VB.NET FAQ Index
Back to Visual Basic (Microsoft) VB.NET Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close