PC Review


Reply
Thread Tools Rate Thread

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

 
 
thomas
Guest
Posts: n/a
 
      19th Sep 2006
Hello,

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

http://msdn2.microsoft.com/en-us/lib...xpression.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


 
Reply With Quote
 
 
 
 
Cor Ligthert [MVP]
Guest
Posts: n/a
 
      19th Sep 2006
Thomas,

the best answer I have is that it is a documentation error.

http://groups.google.com/group/micro...4d9e7eebb4a12c

Does not helps, but maybe something,

Cor

"thomas" <(E-Mail Removed)> schreef in bericht
news:t9JPg.2547$(E-Mail Removed)...
> Hello,
>
> According to the docs it should be possible to use TimeSpan type in
> DataColumn.Expression property.
>
> http://msdn2.microsoft.com/en-us/lib...xpression.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
>



 
Reply With Quote
 
thomas
Guest
Posts: n/a
 
      21st Sep 2006
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]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Thomas,
>
> the best answer I have is that it is a documentation error.
>
> http://groups.google.com/group/micro...4d9e7eebb4a12c
>
> Does not helps, but maybe something,
>
> Cor
>
> "thomas" <(E-Mail Removed)> schreef in bericht
> news:t9JPg.2547$(E-Mail Removed)...
>> Hello,
>>
>> According to the docs it should be possible to use TimeSpan type in
>> DataColumn.Expression property.
>>
>> http://msdn2.microsoft.com/en-us/lib...xpression.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
>>

>
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DataColumn.Expression Property - need other functions Rui Rosa Mendes Microsoft ADO .NET 8 23rd Dec 2003 02:58 PM
DataColumn.Expression Property - need other functions Rui Rosa Mendes Microsoft C# .NET 1 23rd Dec 2003 02:49 PM
DataColumn.Expression Property - need other functions Rui Rosa Mendes Microsoft Dot NET Framework 0 22nd Dec 2003 05:59 PM
How to assign DataColumn's Expression property to my own function? anonymous Microsoft ADO .NET 0 7th Nov 2003 05:52 PM
DataColumn.Expression Property Gert Marginet Microsoft ADO .NET 0 30th Sep 2003 12:29 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:10 PM.