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? 19 1492
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> wrote: 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?
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.co m> http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
"Sput" <sp************ @post.htnet.hr> wrote in message
news:c0******** **@ls219.htnet. hr... 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?
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
Actually, just add a calculated field like a string made from {fn
YEAR(...) } {fn MONTH(...)}
and then just sort on that column. Have the database do the work for you
JIM
"Jon Skeet [C# MVP]" <sk***@pobox.co m> wrote in message
news:MP******** *************** *@msnews.micros oft.com... Sput <sp************ @post.htnet.hr> wrote: 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?
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.co m> http://www.pobox.com/~skeet If replying to the group, please do not mail me too
if anyone of repliers read this...
i have decide to use clarion's solution for dates
my local settings are set correctly
as for skeet, programs written in visual basic using same database respond
correctly
"Morten Wennevik" <Mo************ @hotmail.com> wrote in message
news:op******** ******@msnews.m icrosoft.com... 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.
Is there any culture in which Sunday is not the first day of the week?
There may well be cultures that don't use the week, but...
The first day of *MY* week is now, and always has been MONDAY... My pay period starts on MONDAY Everyone in my organization has their calendar start as MONDAY = Work Week
Starts... My pay period ends on SUNDAY ad infinitum....
Chuck
"Michael A. Covington" <lo**@www.covin gtoninnovations .com.for.addres s> wrote
in message news:ea******** ******@TK2MSFTN GP09.phx.gbl... "Morten Wennevik" <Mo************ @hotmail.com> wrote in message news:op******** ******@msnews.m icrosoft.com... 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. Is there any culture in which Sunday is not the first day of the week?
There may well be cultures that don't use the week, but...
--
C#, .NET and Complex Adaptive Systems: http://blogs.geekdojo.net/Richard
"Sput" <sp************ @post.htnet.hr> wrote in message
news:c0******** **@ls219.htnet. hr... as for skeet, programs written in visual basic using same database respond correctly
But that doesn't matter if the query pulling the dates casts them to string
or if the VB application is compensating for the unwanted sorting behaviour
and the dates really are stored as strings in the database / dataset.
Please give some details (i.e. a small sample app) that show the problem and
its context.
R.
But that is not a difference between nations. It seems to be a conflicting
usage within the United States. I have seen planning calendars that put
Monday first (so that Saturday and Sunday, which aren't supposed to have any
events, can share a box).
"Chuck Conlow" <lv******@earth link.net> wrote in message
news:14******** *********@newsr ead2.news.pas.e arthlink.net... The first day of *MY* week is now, and always has been MONDAY...
My pay period starts on MONDAY Everyone in my organization has their calendar start as MONDAY = Work
Week Starts... My pay period ends on SUNDAY ad infinitum.... Chuck
"Michael A. Covington" <lo**@www.covin gtoninnovations .com.for.addres s>
wrote in message news:ea******** ******@TK2MSFTN GP09.phx.gbl... "Morten Wennevik" <Mo************ @hotmail.com> wrote in message news:op******** ******@msnews.m icrosoft.com... 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. Is there any culture in which Sunday is not the first day of the week?
There may well be cultures that don't use the week, but...
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Blair Dickinson |
last post by:
--BF63.D._B.D
Content-Type: text/plain;
Content-Transfer-Encoding: quoted-printable
EXCLUSIVELY ON CD-ROM
The 2004 edition of The American Medical Directory & Physicians Guide has=
just been completed.
|
by: Pat |
last post by:
----E7AC83C60895C0C204C
Content-Type: text/html;
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Diso-8859=
-1">
|
by: Lampa Dario |
last post by:
Hi, where is this stupid error in this program? When I execute it, i
receive a segmentation fault error.
#include <stdio.h>
int main(int argc, char *argv, char *env) { int i=0; int l=0;
int word=0;
char *querystring;
querystring=malloc(sizeof(char)*100000);
if (getenv("QUERY_STRING")==NULL)
|
by: Amil |
last post by:
I must be missing something very simple. I've had a web site running for a
long time (anonymous access).
Web.config authentication is original (anyone gets in):
<authentication mode="Windows" />
<authorization>
<allow users="*" /> <!-- Allow all users -->
</authorization>
Now I added a html subdirectory that I want to only allow certain windows
|
by: Adam Smith |
last post by:
I have posted this and similar questions repeatedly and can't even raise
a single response. I am being led to believe that this then 'Must be a
stupid question' although people say that there is no stupid question.
Is that another for political correctness
I am attempting an install of 7.4.3 on FreeBSD O/S 4.9, apparently
remnants of 7.3.x are scattered around on the disk from (a) previous
ports installation, causing mutex_lock/unlock,...
| |
by: thechaosengine |
last post by:
Hi guys,
I'm developing a web app on a UK computer. When I put a date into a textbox,
its in the format DD/MM/YY. The DateTime object takes that in and handles
in perfectly.
Now, I need to start using the american format MM/DD/YY.
My question is, how do I get the DateTime object to recognise what I'm passing
in as an American date? If the machine is installed on an american server,
|
by: Simon Harvey |
last post by:
Hi all,
I'm having a bit of a problem working with dates. My computer is british,
but I'm developing an american application so I therefore need to use american
dates. But I can't get my DateTime object to "act" american.
Let me give an example:
In order to take in an american date, I tell it which culture the date will
be formatted according to:
|
by: sparks |
last post by:
We get more and more data done in excel and then they want it imported
into access.
The data is just stupid....values of 1 to 5 we get a lot of 0's ok
that alright but 1-jan ?
we get colums that are formatted for number and then half way down
they are changed to text.
OR the famous ok now everything in red is ---- and everything in blue
is---------. WTF are these people thinking?
|
by: stj911 |
last post by:
http://counterpunch.org/rahni04072007.html
Test Tube Zealots: The American Chemical Society Terminates the
Membership of Chemists from Iran
By DAVID N. RAHNI
The American Chemical Society (ACS) has once again led the way, with
its "zealot" interpretation of "embargo" by the Department of
Treasury's Office of Foreign Asset Control, by terminating the
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |