Use NLS_XXXX Parameters in DBGRID

Jens Fudickar

Member³
Hello Marco,

i know that i have asked you this question some time ago, but i've lost your answer.

How is it possible to use the NLS_XXX Parameters to show DATE or NUMBER Fields in the Databasemode in a dbgrid

Thanks

Jens
 
This can be accomplished by reading the NLS_DATE_FORMAT and NLS_NUMERIC_CHARACTERS from the v$nls_parameters view. You need to interpret these values, and modify the ShortDateFormat, ThousandSeparator and DecimalSeparator formatting variables. Setting these variables will not only affect a TDBGrid, but all date and number conversions that you perform in your application.

The tricky bit is converting Oracle's NLS_DATE_FORMAT to Delphi's ShortDateFormat, for example:

MONTH --> MMMM
MON --> MMM
RRRR --> YYYY
RR --> YY
FM --> (nothing)

------------------
Marco Kalter
Allround Automations
 
Back
Top