System.InvalidCastException
Can any1 tell me why the below line throws an exception?
if ((DateTime.Now.TimeOfDay.CompareTo(((DateTime)RowSchedule["StartEnter"]).TimeOfDay) >= 0) && (DateTime.Now.TimeOfDay.CompareTo(((DateTime)RowTurno["LimiteEnter"]).TimeOfDay) <= 0))
The RowSchedule is a DataRow that retrieve the data from a Table from a DataSet. The table have 6 DateTime columns.
This is the excepton:
System.InvalidCastException
Additional information: Specified cast is not valid.
Any idea?
Thax in advance.
4 Answers
Know the answer? Post it. Somebody with the same question will find it here.

bilnaadRank #2,169 · 655 reputationPosted Oct 12, 2004, 6:46 AM EDT
Carlos SanchezRank #6,113 · 276 reputationPosted Oct 12, 2004, 9:24 AM EDT
bilnaadRank #2,169 · 655 reputationPosted Oct 12, 2004, 3:09 PM EDT
bilnaadRank #2,169 · 655 reputationPosted Oct 12, 2004, 3:10 PM EDT