如何通过sql对Crystal报表中的日期字段进行排序? [英] How can I sort date field in crystal report by sql?

查看:95
本文介绍了如何通过sql对Crystal报表中的日期字段进行排序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在vb.net中创建了一个软件项目,并使用了一个水晶报表,其中使用了我在sql server 2000中创建的视图,然后通过向导将其附加.
那里显示了所有字段,并且工作正常,但是我需要问一下我使用的是哪个字段,它显示了一个保存在我的sql数据库中的日期,如下所示:

dd/mm/yy(10/11/2010)

因此,我的问题是,是否有人可以告诉我如何按日期在此字段中进行排序?
如果使用查询,则它不适用于查询,因此如何告诉任何完整的代码和方法我该怎么做.
并且请告诉我如何使用这样的时间格式:
上午10:20
晚上10:30

请全部告诉我

I made a project for software in vb.net and I use a crystal report where I used a view which I made in sql server 2000 and then I attached it by wizard.
There it shows all fields and its works fine but I need to ask that I am using there is a field which is shows a date which is saved in my sql database like this:

dd/mm/yy ( 10/11/2010)

So, my question is if anyone could tell me how I can sort this field here by date?
If used query then it is not working with query so how please tell any one complete code and way that how can I do that.
And please tell me how I can use time format like this:
10:20 am
10:30 pm

Please tell me all please

推荐答案

您可以使用SQL(SELECT * FROM YOURTABLE ORDER BY YOURFIELD ASC)带来已经订购的数据.或者,您可以使用Crystal Report的table属性并选择要排序的列.

关于数据格式,可以使用
FormatDateTime(DateTime.Now,DateFormat.ShortTime)

例如,如果您在美国,它将显示10:20 pm,但是,例如,如果您在巴西,它将显示22:20

希望我能对您有所帮助.
You can bring the data already ordered using the SQL (SELECT * FROM YOURTABLE ORDER BY YOURFIELD ASC). Or you can use the table property of Crystal Report and select the column to be ordered.

About the data format, you can use
FormatDateTime(DateTime.Now, DateFormat.ShortTime)

If you are in USA, for example, it will show you 10:20 pm, but, if you are in Brazil, for example, it will show you 22:20

Hope I could''ve helped you.


这篇关于如何通过sql对Crystal报表中的日期字段进行排序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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