[Mono-dev] Arrays in a loop?

Gaurav Vaish (Mono) gvaish.mono at gmail.com
Mon Oct 3 21:28:15 EDT 2005


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


--
Cheers,
Gaurav Vaish
http://mastergaurav.org
-----------------------------




More information about the Mono-devel-list mailing list