Re: How can I sort a datetime column in a dataset.
- From: "Cor Ligthert [MVP]" <notmyfirstname@xxxxxxxxx>
- Date: Sun, 18 Sep 2005 21:14:53 +0200
Hi,
> Im using the following code to sort columns in a data set:
> ds.Tables[0].DefaultView.Sort
>
> However, datetime fields pulled from the database are sorted as strings
> and thus incorrectly. How do I sort the datetime fields properly?
> Thanks.
I did not check it, however it sounds strange to me that the datetime, which
is written in memory as a long that contains ticks which are counted by
hundereds of nanosecond units after the year 01:01:01 would be first
converted to a string. Straight sorting the tick gives the right result.
Did you try this?
(Assuming that your field is really a datetime field and not a real string).
I hope this helps,
Cor
.
- Follow-Ups:
- Re: How can I sort a datetime column in a dataset.
- From: em00guy
- Re: How can I sort a datetime column in a dataset.
- References:
- How can I sort a datetime column in a dataset.
- From: em00guy
- How can I sort a datetime column in a dataset.
- Prev by Date: Re: DataSet.GetChanges() in RowChanged(DataRowAction.Add)
- Next by Date: Re: DataSet.GetChanges() in RowChanged(DataRowAction.Add)
- Previous by thread: How can I sort a datetime column in a dataset.
- Next by thread: Re: How can I sort a datetime column in a dataset.
- Index(es):
Relevant Pages
|
Loading