Board index » delphi » NT 4 Regional settings & Delphi 2

NT 4 Regional settings & Delphi 2

I have a (serious) problem showing Paradox Date and Money fields in Finnish
format.

I'd like to know from where Delphi gets the format it uses to show dates
and currency?

The Money and Date fields look fine in Database Desktop. The Money field
shows values formatted "# ###,## mk" and the Date field formatted
"DD.MM.YYYY" (just as I want to).

Database Explorer and Delphi DBGrid format the Money field like this "$
###.##" and the Date field "M/D/YY". Also if I show the current date using
following code the date is formatted "M/D/YY":
   vToday := DateToStr(Date);
   Showmessage(vToday);

I believe this is the reason for the problems I am having with my current
project (all these problems started after I installed NT 4).

The other problem I'm having is using a parametrized SQL-query. I am trying
to calculate sum from money-fields before current date. I'm using following
SQL string
    SELECT SUM(mk) FROM transactions WHERE Pvm < :vToday

I get an errormessage "Field '9/3/97' not found" where '9/3/97' is always
the current date. I have defined the parameter vToday as String in the
Query-components "Parameters" (I have also tried Date type with a "Type
mismatch" error).

I have following settings in my computer:
  BDE Configuration Utility:
      Drivers - page
          Paradox Langdriver = Paradox 'swedfin'
      System - page
          Langdriver = Paradox 'swedfin'
       Date, Time and Number - pages
          Finnish settings as they are in NT's regional settings

  NT 4 Regional Settings
       Finnish (all the settings are correct)

Please help if you have any idea of what's the reason for this.

Many thanks
''''''''''''''''''''''''''''''''''''''
Kari Selovuo
email: s...@clinet.fi

 

Re:NT 4 Regional settings & Delphi 2


Click on SYSTEM LOCALE on regional setting and then try again.  If it does
work email me.

Re:NT 4 Regional settings & Delphi 2


Quote
"Kari Selovuo" <s...@clinet.fi> wrote:
>I have a (serious) problem showing Paradox Date and Money fields in Finnish
>format.
>I'd like to know from where Delphi gets the format it uses to show dates
>and currency?

These "locale" settings are stored in the SysUtils unit's variables.
For example, the varibale ThousandSeparator specifies the thousand
separator char (a space in Finland). These variables are read when the
application starts.

Quote
>The Money and Date fields look fine in Database Desktop. The Money field
>shows values formatted "# ###,## mk" and the Date field formatted
>"DD.MM.YYYY" (just as I want to).
>Database Explorer and Delphi DBGrid format the Money field like this "$
>###.##" and the Date field "M/D/YY". Also if I show the current date using
>following code the date is formatted "M/D/YY":
>   vToday := DateToStr(Date);
>   Showmessage(vToday);
>I believe this is the reason for the problems I am having with my current
>project (all these problems started after I installed NT 4).

It seems that somehow the regional settings are read incorrectly. Have
you tried to manually adjust the SysUtils variables?

Quote
>The other problem I'm having is using a parametrized SQL-query. I am trying
>to calculate sum from money-fields before current date. I'm using following
>SQL string
>    SELECT SUM(mk) FROM transactions WHERE Pvm < :vToday
>I get an errormessage "Field '9/3/97' not found" where '9/3/97' is always
>the current date. I have defined the parameter vToday as String in the
>Query-components "Parameters" (I have also tried Date type with a "Type
>mismatch" error).

I had a very similar problem when using Access tables with D1. The
problem was that I simply couldn't get date field comprasion to work,
no matter what I did. So my solution was to manually create the
queries, substituting date in correct format (M/D/YY in Access)
manually.

BTW, have you tried to "quote" the date parameter? It might also help.

HTH.

Regards,

Jani J?rvinen
a.k.a SilverStream Software
Helsinki Finland

Tools, information, tips, reviews & bug lists
for professional Delphi, Win32 and WinHelp developers.

mailto:ja...@dystopia.fi
http://www.dystopia.fi/~janij/

Other Threads