DataColumn.Expression Property and TimeSpan type (.Net 2.0)

  • Thread starter Thread starter thomas
  • Start date Start date
T

thomas

Hello,

According to the docs it should be possible to use TimeSpan type in
DataColumn.Expression property.

http://msdn2.microsoft.com/en-us/library/system.data.datacolumn.expression.aspx
- see the Convert function description.

I just can not figure out how to specify TimeSpan value. Her is what I have
been trying:

myDateTable.Columns.Add("DateCreated", typeof(DateTime), "_DateCreatedUTC +
Convert('-05:00:00', 'System.TimeSpan')");
- it fails with the FormatException: "The string '-05:00:00' is not a valid
TimeSpan value."

Yes, I know this can be accomplished in different ways, but I am wondering
how to do it this way.

Any ideas? Thank you,

Tomasz
 
Thank you. But this still puzzles me. The attempt to use TimeSpan throws
FormatException, not some unsupported type exception. It seems like this was
intended to work but was not implemented. Anyway, sounds like it is a bug,
definitely not one of top priority since it has been around for a while.

Tomasz
 
Back
Top