September 2003
Intermediate to advanced
624 pages
14h 27m
English
When a column in a
database
has a null value, you want the value in the
DataSet to be a string indicating that no value is
available.
Use annotations in
the
XML schema to control the handling of
null values.
The sample uses one XSD file:
CategoriesDS_AnnotatedNull.xsdThe schema used to generate the strongly typed
DataSet. The schema is annotated so the
null Description values are replaced with the
string "- no
description available
-“. The annotations are marked in
bold in Example 2-25.
Example 2-25. File: TypedDataSets\CategoriesDS_AnnotatedNull.xsd
<?xml version="1.0" standalone="yes" ?>
<xs:schema id="CategoriesDS_AnnotatedNull"
targetNamespace=
"http://www.tempuri.org/CategoriesDS_AnnotatedNull.xsd"
xmlns:mstns="http://www.tempuri.org/CategoriesDS_AnnotatedNull.xsd"
xmlns="http://www.tempuri.org/CategoriesDS_AnnotatedNull.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
xmlns:codegen="urn:schemas-microsoft-com:xml-msprop" attributeFormDefault="qualified" elementFormDefault="qualified"> <xs:element name="CategoriesDS_AnnotatedNull" msdata:IsDataSet="true"> <xs:complexType> <xs:choice maxOccurs="unbounded"> <xs:element name="Categories"> <xs:complexType> <xs:sequence> <xs:element name="CategoryID" msdata:ReadOnly="true" msdata:AutoIncrement="true" type="xs:int" /> <xs:element name="CategoryName" type="xs:string" /> <xs:element name="Description" type="xs:string" ...Read now
Unlock full access