N
news.microsoft.com
Im am trying to load a Data from a DataReader into a DataTable with the
following code. I am getting a cast error at the LoadDataRow statement.
while(reader.Read())
{
object[] rowobjects = new
object[ratestructurecompound._DataTable_RateStructureTbl.Columns.Count];
reader.GetSqlValues(rowobjects);
ratestructurecompound._DataTable_RateStructureTbl.LoadDataRow(rowobjects,
true);
}
Here is the error message:
"System.InvalidCastException: Specified cast is not valid.\r\n at
System.Convert.ToDateTime(Object value)\r\n at
System.Data.Common.DateTimeStorage.Set(Int32 record, Object value)\r\n
at System.Data.DataColumn.set_Item(Int32 record, Object value)Couldn't
store <4/5/2004 3:04:00 PM> in CreateDatetime Column. Expected type is
DateTime."
I thought this method was suppose to cast properly.
following code. I am getting a cast error at the LoadDataRow statement.
while(reader.Read())
{
object[] rowobjects = new
object[ratestructurecompound._DataTable_RateStructureTbl.Columns.Count];
reader.GetSqlValues(rowobjects);
ratestructurecompound._DataTable_RateStructureTbl.LoadDataRow(rowobjects,
true);
}
Here is the error message:
"System.InvalidCastException: Specified cast is not valid.\r\n at
System.Convert.ToDateTime(Object value)\r\n at
System.Data.Common.DateTimeStorage.Set(Int32 record, Object value)\r\n
at System.Data.DataColumn.set_Item(Int32 record, Object value)Couldn't
store <4/5/2004 3:04:00 PM> in CreateDatetime Column. Expected type is
DateTime."
I thought this method was suppose to cast properly.