[Mono-dev] Getting error at Runtime
Javier Ruiz
javierruiz at houston.rr.com
Sat Feb 11 03:48:22 EST 2006
The error is coming from the SYSTEM.NET.MAIL part of the code.
-----Original Message-----
From: mike.hull at coversant.net [mailto:mike.hull at coversant.net]
Sent: Saturday, February 11, 2006 12:43 AM
To: Javier Ruiz
Cc: mono-devel-list at lists.ximian.com
Subject: Re: [Mono-dev] Getting error at Runtime
Javier Ruiz wrote:
> I get the following error at runtime from the attached code.
>
> ERROR:
> Object reference not set to an instance of an object
>
> I still don't understand why if I compile the code using VS 2005 and
> run the program on windows it works but if I compile with gmcs and run
> on Linux I get errors.
Is there a stack trace?
ex.ToString() should give you a better idea of what it is.
I think your problem is here:
string sysdate = (string)dbreader["sysdate"].ToString();
If that dbreader["sysdate"] == null then you'll get a NRE.
Try this:
object sysdate = dbreader["sysdate"];
string sysdate = sysdate == null ? string.Empty : sysdate.ToString();
More information about the Mono-devel-list
mailing list