Cast of DBNull
Hi , I got a problem in formatting of date
when i try to do the following,
if(c.Value.GetType() != typeof(DBNull))
{
DateTime dt = DateTime.Parse(c.Value.ToString());
c.Value = dt.ToString("dd/MM/yyyy");
}
It says "Object cannot be cast from DBNull to other types"
what i have to do ...
pls help me soon as possible guys.
thank u
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.

rencels21 reputationPosted Feb 28, 2005, 3:21 AM EST
sdnaffi12 reputationPosted Feb 28, 2005, 5:09 PM EST
Andrzej WegierskiRank #1,729 · 877 reputationPosted Mar 1, 2005, 1:45 AM EST