INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

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!

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

Jobs

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:sequence>
  <xs:element name="Mode_ID" type="xs:string" />
  <xs:element name="Description" type="xs:string" />
  <xs:element name="SYS_REC" type="xs:boolean" />
</xs:sequence>

...
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:sequence>
  <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" />
</xs:sequence>
...
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!
Paul

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

My Archive

Resources

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