[Mono-devel-list] Bug in System.Data.Common.DataContainer.cs ? (ALL DataContainers should check for DBNull in SetItemFromDataRecord ?)

MN mn at electroputere.ro
Tue Jul 27 04:55:08 EDT 2004


I work with an Firebird database and I have a table with a date field that
allows nulls and have null values.
When I try to fill a DataSet from this table I get a FillError (the result
follows).

Should ALL DataContainers check for DBNull in SetItemFromDataRecord ?

FbDataAdtapter da = new FbDataAdaper(cmd);
....
DataSet ds = new DataSet();
da.FillError += FillError;
da.Fill(ds); /// <---------------- fill error
...

private void FillError(object sender, FillErrorEventArgs e)
{
    Console.WriteLine(e.Errors.ToString());
}



System.InvalidCastException: Cannot cast from source type to destination
type.
in [0x00005] (at /cvs/mcs/class/corlib/System/DBNull.cs:84)
System.DBNull:System.IConvertible.ToDateTime (System.IFormatProvider)
in [0x00013] (at /cvs/mcs/class/corlib/System/Convert.cs:720)
System.Convert:ToDateTime (object,System.IFormatProvider)
in [0x0000e] (at /cvs/mcs/class/corlib/System/Convert.cs:713)
System.Convert:ToDateTime (object)
in <0x00056> FirebirdSql.Data.Firebird.FbDataReader:GetDateTime (int)
in [0x00004] (at
/cvs/mcs/class/System.Data/System.Data.Common/DataContainer.cs:1102)
DateTimeDataContainer:SetItemFromDataRecord
(int,System.Data.IDataRecord,int)
in [0x0006d] (at /cvs/mcs/class/System.Data/System.Data/DataRow.cs:423)
System.Data.DataRow:SetValuesFromDataRecord (System.Data.IDataRecord,int[])




More information about the Mono-devel-list mailing list