G
Guest
Using C# 2.0 & SQL Server 2000, have a stored procedure that return 0, 1, or
more rows. At least one of the columns is a date and it may null. I have
created an XSD of the output from the stored proc. The entry for the
nullable date column is "<xs:element name="Sent_Dttm" minOccurs="0"
type="xs:dateTime" nillable="true"></xs:element>". I copied the XSD to the
C# 2.0 windows app I am developing and it nicely generates a strongly typed
dataset.
The problem is I get an error when attempting to access this column in the
dataset when the value is null:
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
public System.DateTime Sent_Dttm {
get {
try {
return
((System.DateTime)(this[this.tableOwizCommDoc.Sent_DttmColumn]));
}
catch (System.InvalidCastException e) {
throw new System.Data.StrongTypingException("The
value for column \'Sent_Dttm\' in table \'OwizCommDoc\' is DBNull.", e);
}
}
set {
this[this.tableOwizCommDoc.Sent_DttmColumn] = value;
}
}
Checking the properties of this field, I noticed that the "NullValue"
property has a value of "(throw exception)'
more rows. At least one of the columns is a date and it may null. I have
created an XSD of the output from the stored proc. The entry for the
nullable date column is "<xs:element name="Sent_Dttm" minOccurs="0"
type="xs:dateTime" nillable="true"></xs:element>". I copied the XSD to the
C# 2.0 windows app I am developing and it nicely generates a strongly typed
dataset.
The problem is I get an error when attempting to access this column in the
dataset when the value is null:
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
public System.DateTime Sent_Dttm {
get {
try {
return
((System.DateTime)(this[this.tableOwizCommDoc.Sent_DttmColumn]));
}
catch (System.InvalidCastException e) {
throw new System.Data.StrongTypingException("The
value for column \'Sent_Dttm\' in table \'OwizCommDoc\' is DBNull.", e);
}
}
set {
this[this.tableOwizCommDoc.Sent_DttmColumn] = value;
}
}
Checking the properties of this field, I noticed that the "NullValue"
property has a value of "(throw exception)'