排序集合 [英] Sorting A Collection

查看:73
本文介绍了排序集合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个集合,其中集合中的项目是日期。我想

迭代集合并为列表框的rowsource

构建一个值列表字符串。集合中的日期不是按时间顺序排列的。

有没有办法在创建值列表字符串之前首先对集合进行排序并按时间顺序将日期按照b $ b顺序排列?或者,我将如何迭代

按时间顺序抽出日期?


谢谢!


Scott

解决方案

2004年12月16日星期四03:17:49 GMT,Scott < sm ***** @nospam.please>

写道:


一个想法是使用断开连接的ADO记录集来保存你的

集合。你可以凭空创造一个。它们是可排序的。


另一种方法是使用排序算法,例如bubblesort或qsort。


-Tom。

我有一个集合,其中集合中的项目是日期。我想重复集合并为列表框的rowsource构建一个值列表字符串。集合中的日期不是按时间顺序排列的。在创建值列表字符串之前,有没有办法首先对集合进行排序并按时间顺序排列日期?或者,我将如何迭代按时间顺序抽出日期的集合?

谢谢!

Scott




2004年12月15日星期三21:13:13 -0700,Tom van Stiphout< no ************* @ cox.net> ;

写道:

2004年12月16日星期四03:17:49 GMT,斯科特 < sm ***** @nospam.please>
写道:

一个想法是使用断开连接的ADO记录集来保存您的
集合。你可以凭空创造一个。它们是可排序的。


这也是我的建议。我已经习惯了,并且很好地工作了很多。从技术上讲,这些被称为Fabricated Recordsets,而不是
断开连接的记录集

另一种方法是使用排序算法,例如bubblesort或qsort。




我也做到了。使用ADO技术< g>。


Scott,


您的集合是什么?它不是表格或查询吗?我会假设

它是,在这种情况下,您需要做的就是使列表框''的rowsource

proprty一个查询(而不是值列表)来读取从表中(或

现有查询),并在日期排序。无需编码。


HTH,

Nikos


Scott写道:

我有一个集合,其中集合中的项目是日期。我想重复集合并为列表框的rowsource构建一个值列表字符串。集合中的日期不是按时间顺序排列的。在创建值列表字符串之前,有没有办法首先对集合进行排序并按时间顺序排列日期?或者,我将如何迭代按时间顺序抽出日期的集合?

谢谢!

Scott



I have a collection where the items in the collection are dates. I want to
iterate over the collection and build a value list string for the rowsource
of a listbox. The dates in the collection are not in chronological order. Is
there a way to first sort the collection and put the dates in chronological
order before creating the value list string? Or, how would I iterate over
the collection pulling out the dates in chronological order?

Thanks!

Scott

解决方案

On Thu, 16 Dec 2004 03:17:49 GMT, "Scott" <sm*****@nospam.please>
wrote:

One idea would be to use a disconnected ADO recordset to hold your
collection. You can create one out of thin air. They are sortable.

Another would be to use a sorting algorithm, e.g. bubblesort or qsort.

-Tom.

I have a collection where the items in the collection are dates. I want to
iterate over the collection and build a value list string for the rowsource
of a listbox. The dates in the collection are not in chronological order. Is
there a way to first sort the collection and put the dates in chronological
order before creating the value list string? Or, how would I iterate over
the collection pulling out the dates in chronological order?

Thanks!

Scott




On Wed, 15 Dec 2004 21:13:13 -0700, Tom van Stiphout <no*************@cox.net>
wrote:

On Thu, 16 Dec 2004 03:17:49 GMT, "Scott" <sm*****@nospam.please>
wrote:

One idea would be to use a disconnected ADO recordset to hold your
collection. You can create one out of thin air. They are sortable.
That was going to be my suggestion as well. I''ve used that, and works very
nicely. Technically, though, those are called Fabricated Recordsets, not
Disconnected Recordsets
Another would be to use a sorting algorithm, e.g. bubblesort or qsort.



I''ve done that, too. Use the ADO technique <g>.


Scott,

What is your "collection"? Is it not a table or a query? I would assume
it is, in which case all you need to do is make the listbox''s rowsource
proprty a query (instead of a value list) to read from the table (or
existing query), and sort on date. No coding required.

HTH,
Nikos

Scott wrote:

I have a collection where the items in the collection are dates. I want to
iterate over the collection and build a value list string for the rowsource
of a listbox. The dates in the collection are not in chronological order. Is
there a way to first sort the collection and put the dates in chronological
order before creating the value list string? Or, how would I iterate over
the collection pulling out the dates in chronological order?

Thanks!

Scott



这篇关于排序集合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆