愚蠢的美国制度 [英] stupid american system

查看:75
本文介绍了愚蠢的美国制度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对C#中看似不可变的设置感到非常沮丧。

例如,从按日期排序的数据库中获取数据会返回错误的订单

(如果我是正确的话)正在使用美国约会系统)。同样适用于

排序数据网格(排序日期和

十进制数字 - 即31.12.2004按第一个数字而不是第二个数字排序

和100.000 ,00被视为文本)。

是否有一种简单的方法可以改变这种情况,还是我自己编写排序

函数?

I am thoroughly frustrated with these seemingly unchangable settings in C#.
For example, fetching data from database sorted by date returns wrong order
(would be correct if I was using american date system). Same goes for
sorting datagrid (sorts dates and
decimal numbers - ie 31.12.2004 is sorted by first number instead of second
and 100.000,00 is treated as text ).
Is there a simple way of changing this or am I to write my own sorting
functions?

推荐答案

我不知道是否可以更改,但同样适用于工作日

枚举,它将星期日作为第一天独立于文化。

-

Hotmail帐户很可能不会被阅读,所以请只回复

给新闻组。
I don''t know if it can be changed, but the same applies to weekday
enumeration which puts sunday as the first day independent of the culture.
--
The hotmail account will most likely not be read, so please respond only
to the news group.


Sput< sp ************ @ post.htnet.hr>写道:
Sput <sp************@post.htnet.hr> wrote:
我对C#中这些看似不可变的设置感到非常沮丧。
例如,从按日期排序的数据库中获取数据会返回错误的顺序
(如果我是的话,那将是正确的使用美国约会系统)。
排序datagrid也是一样的(排序日期和
十进制数 - 即31.12.2004按第一个数字排序而不是第二个
而100.000,00被视为文本)。
是否有一种简单的方法可以改变这种情况,还是我要编写自己的排序功能?
I am thoroughly frustrated with these seemingly unchangable settings in C#.
For example, fetching data from database sorted by date returns wrong order
(would be correct if I was using american date system). Same goes for
sorting datagrid (sorts dates and
decimal numbers - ie 31.12.2004 is sorted by first number instead of second
and 100.000,00 is treated as text ).
Is there a simple way of changing this or am I to write my own sorting
functions?




在开始指责C#之前:


1)C#只是语言,而不是库。


2)当你谈到从按日期排序的数据库中获取数据时 -

您是按日期在数据库端还是在客户端进行排序?如果

它在数据库端,那怎么可能是C#的错?


3)你实际上是在日期存储日期吗?数据库中的列?


如果是在客户端,应该可以在

简单的测试程序中看到所有这些填充数据表而实际上没有
进入数据库。如果你能制作这样的节目,我会看到

我可以做什么。


-

Jon Skeet - < sk *** @ pobox.com>
http:// www .pobox.com / ~siget

如果回复小组,请不要给我发邮件



Before you start blaming C#:

1) C# is only the language, not the library

2) When you talk about "fetching data from database sorted by date" -
are you sorting by date on the database side, or on the client side? If
it''s on the database side, how can it be C#''s fault?

3) Are you actually storing the dates in date columns in the database?

If it''s on the client side, it should be possible to see all this in a
simple test program which just populates a data table without actually
going to a database. If you could produce such a program, I''ll see what
I can do.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too




" Sput" < SP ************ @ post.htnet.hr>在消息中写道

news:c0 ********** @ ls219.htnet.hr ...

"Sput" <sp************@post.htnet.hr> wrote in message
news:c0**********@ls219.htnet.hr...
我对这些看似不可变的设置感到非常沮丧在
C#中。例如,从按日期排序的数据库中获取数据会返回错误的
顺序(如果我使用的是美国日期系统,那将是正确的)。
排序datagrid也是如此(排序日期和
十进制数 - 即31.12.2004按第一个数字排序,而不是
秒,100.000,00被视为文本)。
是否有一种简单的方法可以改变这种情况,还是我要编写自己的排序功能?
I am thoroughly frustrated with these seemingly unchangable settings in C#. For example, fetching data from database sorted by date returns wrong order (would be correct if I was using american date system). Same goes for
sorting datagrid (sorts dates and
decimal numbers - ie 31.12.2004 is sorted by first number instead of second and 100.000,00 is treated as text ).
Is there a simple way of changing this or am I to write my own sorting
functions?




许多例程''读''的语言环境设置计算机和数据库。

他们如何处理你提到的情况往往是一个有趣的框架类型(及其方法)和数据库之间的联合精神病
存储类型和DBA约定和设置。


您可以通过确保您的Windows版本是特定的

语言/ locate来开始版本和本地设置设置正确 - 以及

数据库。如果你一直只在一个地方工作,这是有效的。


然而,如果,正如我所料,你正在使用双重工作。语言/语言环境

环境,那么最精通的解决方案是创建自己的排序

例程和转换类(类型),因为你可能会继续使用

在未来一段时间内与地区差异作斗争。


-ralph



Many routines ''read'' the locale settings of the computer and the database.
How they will handle situations as you mentioned is often an interesting
joint-psychosis between the Framework types (and their methods) and Database
storeage types and DBA conventions and settings.

You can start-out by making sure your Windows version is the specific
language/locate version and local settings are setup correctly - as well as
the database. This works if you are only working in one locale all the time.

However, if, as I expect, you are working in a "dual" language/locale
environment, then the most proficient solution IS to create your own sorting
routines and conversion classes (types), as you will likely be continuely
fighting locale differences for some time to come.

-ralph


这篇关于愚蠢的美国制度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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