PC Review Forums Newsgroups Microsoft DotNet Microsoft ADO .NET DataColumn.Expression Property and TimeSpan type (.Net 2.0)

Reply

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

 
Thread Tools Rate Thread
Old 19-09-2006, 04:07 AM   #1
thomas
Guest
 
Posts: n/a
Default DataColumn.Expression Property and TimeSpan type (.Net 2.0)


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


  Reply With Quote
Old 19-09-2006, 05:21 AM   #2
Cor Ligthert [MVP]
Guest
 
Posts: n/a
Default Re: DataColumn.Expression Property and TimeSpan type (.Net 2.0)

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
>



  Reply With Quote
Old 21-09-2006, 01:59 AM   #3
thomas
Guest
 
Posts: n/a
Default Re: DataColumn.Expression Property and TimeSpan type (.Net 2.0)

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
>>

>
>
>



  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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off