A
Ahmed
All of a sudden a bug crept up in my program where i am inserting something
in a newly created datarow.
Here is a little sample:
drCurrent = tblCalls.NewRow() 'Now this is how i define a new datarow
(drcurrent is a datarow datarow)
drCurrent.Item(0) = timeStart
drCurrent.Item(1) = timeEnd <- Exception thrown here! as the following
"An unhandled exception of type 'System.ArgumentException' occurred in
system.data.dll
Additional information: System.InvalidCastException: Invalid cast from
DateTime to Int32.
at System.DateTime.System.IConvertible.ToInt32(IFormatProvider provider)
at System.Convert.ToInt32(Object value)
at System.Data.Common.Int32Storage.Set(Int32 record, Object value)
at System.Data.DataColumn.set_Item(Int32 record, Object value)Couldn't
store <5/20/2004 1:10:25 AM> in Call_Id Column. Expected type is Int32."
Now both timeStart and timeEnd are of DateTime data type....this actually
worked perfectly and all of a sudden i am getting exceptions and i am not
quite sure why?
Can anyone help me out here?
TIA,
Ahmed
in a newly created datarow.
Here is a little sample:
drCurrent = tblCalls.NewRow() 'Now this is how i define a new datarow
(drcurrent is a datarow datarow)
drCurrent.Item(0) = timeStart
drCurrent.Item(1) = timeEnd <- Exception thrown here! as the following
"An unhandled exception of type 'System.ArgumentException' occurred in
system.data.dll
Additional information: System.InvalidCastException: Invalid cast from
DateTime to Int32.
at System.DateTime.System.IConvertible.ToInt32(IFormatProvider provider)
at System.Convert.ToInt32(Object value)
at System.Data.Common.Int32Storage.Set(Int32 record, Object value)
at System.Data.DataColumn.set_Item(Int32 record, Object value)Couldn't
store <5/20/2004 1:10:25 AM> in Call_Id Column. Expected type is Int32."
Now both timeStart and timeEnd are of DateTime data type....this actually
worked perfectly and all of a sudden i am getting exceptions and i am not
quite sure why?
Can anyone help me out here?
TIA,
Ahmed