PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft ADO .NET
DataColumn.Expression Property and TimeSpan type (.Net 2.0)
Forums
Newsgroups
Microsoft DotNet
Microsoft ADO .NET
DataColumn.Expression Property and TimeSpan type (.Net 2.0)
![]() |
DataColumn.Expression Property and TimeSpan type (.Net 2.0) |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
Hello,
According to the docs it should be possible to use TimeSpan type in DataColumn.Expression property. http://msdn2.microsoft.com/en-us/li...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 |
|
|
|
#2 |
|
Guest
Posts: n/a
|
Thomas,
the best answer I have is that it is a documentation error. http://groups.google.com/group/micr...84d9e7eebb4a12c Does not helps, but maybe something, Cor "thomas" <tom@tom.com> schreef in bericht news:t9JPg.2547$GR.108@newssvr29.news.prodigy.net... > Hello, > > According to the docs it should be possible to use TimeSpan type in > DataColumn.Expression property. > > http://msdn2.microsoft.com/en-us/li...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 > |
|
|
|
#3 |
|
Guest
Posts: n/a
|
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 "Cor Ligthert [MVP]" <notmyfirstname@planet.nl> wrote in message news:OEHoUL62GHA.4388@TK2MSFTNGP03.phx.gbl... > Thomas, > > the best answer I have is that it is a documentation error. > > http://groups.google.com/group/micr...84d9e7eebb4a12c > > Does not helps, but maybe something, > > Cor > > "thomas" <tom@tom.com> schreef in bericht > news:t9JPg.2547$GR.108@newssvr29.news.prodigy.net... >> Hello, >> >> According to the docs it should be possible to use TimeSpan type in >> DataColumn.Expression property. >> >> http://msdn2.microsoft.com/en-us/li...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 >> > > > |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

