[Mono-dev] Arrays in a loop?
Jackson Harper
jackson at ximian.com
Wed Oct 5 00:46:51 EDT 2005
On Tue, 2005-10-04 at 22:41 -0400, SigmaX wrote:
> Gaurav Vaish (Mono) wrote:
> >> lms_table[i, 0] =
> >> Convert.ToSingle(row[keytext]);
> >> lms_table[i, 1] = Convert.ToSingle(row["L"]);
> >> lms_table[i, 2] = Convert.ToSingle(row["M"]);
> >> lms_table[i, 3] = Convert.ToSingle(row["S"]);
> >
> > Change all conversions to something like:
> >
> > row.IsDBNull("L") ? 0 : row.GetFloat("L")
> >
> > 0 can be replaced with some default value.
> > What is happening is that in case of NULL values (in DB), conversion
> > fails.
> >
> >
>
> Thanx for the tip, but I get:
>
> 'System.Data.DataRow' does not contain a definition for
> `IsDBNull'(CS0117)
>
> When I try to use your suggested fix.
Try using the Convert::IsDBNull
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemconvertclassisdbnulltopic.asp
Jackson
> Any help?
> Thanx,
> SigmaX
>
More information about the Mono-devel-list
mailing list