[Mono-devel-list] Another C# ?: InvalidCastException
Francisco Figueiredo Jr.
fxjrlists at yahoo.com.br
Mon Dec 13 17:49:21 EST 2004
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Rafael Teixeira wrote:
| All fields are Not Null in the database? If not you can't cast then
| directly, you have to check if they are null, because in that case
| they are a dbnull object not a string and surely not a boxed integer
| to be cast.
|
Hi Eric.
What provider are you using to connect to Postgresql?
If it is Npgsql you will receive, as Rafael said, a DBNull.Value object
for null values and you will get cast exceptions with code like yours.
The best way would use a helper function which would take care of that.
I hope it helps.
- --
Regards,
Francisco Figueiredo Jr.
Membro Fundador do Projeto MonoBrasil - MonoBrasil Project Founder Member
http://monobrasil.softwarelivre.org
- -------------
"Science without religion is lame;
religion without science is blind."
~ ~ Albert Einstein
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iQEUAwUBQb4ccf7iFmsNzeXfAQLbtAf4lRHRfWtI154wh74rLcXhlr08TiMC19/P
Mmw5wjqbEmoDmgX2cArLRxKd12qNr5HLHkF2CzameaqBAM6e7zqRMNWhaZqMx/8i
yUcYbxxd/YodhQ5M/h+kHxbooaeOOPhHwkS2lgVf6+gjNi55DYH29eIOujUbNxGV
z1Xi0Icv35xrJKW5t70e7TbldUnYU3DB6JcrxoMgt7hBXP4E4qNed6tE6txyBV2e
QXsqgft2dbLrk74aKIXp3j9bZnxDg0pXJOAsROpcmN4ZoolHUiS+XPO5TgEVhz7c
OYtgVPT6lKW9B5D4oOMaVF1gFMm0LqKpbxJ79jd1dKTzYIKA9Lcw
=79kW
-----END PGP SIGNATURE-----
More information about the Mono-devel-list
mailing list