Re: Sorted data is not sorted
- From: "Marina" <someone@xxxxxxxxxx>
- Date: Thu, 20 Oct 2005 16:53:05 -0400
I don't think Select looks at the deafault view's sort. It just works with
the underlying order of the rows.
Use a dataview as your datasource, and put a filter on it.
But, if you say you prefer to have your data be sorted by the stored
procedure, why not do that? If you can have the database do the sorting, you
should.
"AMDRIT" <amdrit@xxxxxxxxxxx> wrote in message
news:uDLQxUb1FHA.2072@xxxxxxxxxxxxxxxxxxxxxxx
>I have a table [CoverageLimits] with the following columns
>
> Coverage, Limit, LimitDescription, PerPerson, PerAccident
>
> I load the data from a stored procedure into a datatable
>
> Select Coverage, Limit, LimitDescription, PerPerson, PerAccident From
> CoverageLimits Order By Coverage, PerPerson, PerAccident.
>
> I have manually executed this procedure in Query Analyzer and the data
> comes out in the desired order.
>
> 'A', 'J', '20/40', 20, 40
> 'A', 'K', '25/50', 25, 50
> 'A', 'C', '100/300', 100, 300
>
> While the data is actually stored in the heap in this order
>
> 'A', 'K', '25/50', 25, 50
> 'A', 'C', '100/300', 100, 300
> 'A', 'J', '20/40', 20, 40
>
> When I attempt to populate a combobox with this data from my datatable
>
> dim drs() as datarow
>
> drs = mydatatable.select("Coverage = '" & A & "'")
>
> cbo.DataSource = drs
> cbo.DisplayMember = "LimitDescription"
> cbo.ValueMember = "Limit"
>
> The data is displayed in its natural ordered state. So then I attempted
> to sort the data in the table
>
> dim drs() as datarow
> mydatatable.defaultview.sort = "Coverage, PerPerson, PerAccident"
> drs = mydatatable.select("Coverage = '" & A & "'")
>
> cbo.DataSource = drs
> cbo.DisplayMember = "LimitDescription"
> cbo.ValueMember = "Limit"
>
> The data is still displayed in its natural ordered state. Now I can
> attempt to sort the array of datarows, but this seems kind of a wasted
> step, I would prefer the data be ordered by my stored procedure.
>
> Anyone have any ideas how I can achieve the desired result?
>
> TIA
>
.
- Follow-Ups:
- Re: Sorted data is not sorted
- From: AMDRIT
- Re: Sorted data is not sorted
- References:
- Sorted data is not sorted
- From: AMDRIT
- Sorted data is not sorted
- Prev by Date: Sorted data is not sorted
- Next by Date: Re: DB insert problems with apostrophe in a Surname and Datetime value
- Previous by thread: Sorted data is not sorted
- Next by thread: Re: Sorted data is not sorted
- Index(es):
Relevant Pages
|