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

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
 
T

thomas

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top