Change Oracle session to accept comma and dot number in C#

Asked

Viewed 3,307 times

3

When opening an oracle connection on C#, I need you to . and the , behave according to the rule 0.000,00 a real number. I would like to know how to change this format in the open session on OracleConnection

  • How are you assembling your sentence? You can put an example code?

  • Starting with the title sentence: "comma and..."? and...?

  • 2

    @bfavaretto It must be a dramatic pause.

  • not q I run sql on various machines and each one is configured in a way, some are with padarao ingles (.) and others the separator and the port pattern(,), I already forced the program to stay in ports.

  • wanted to know c has how to change the oracle session charset

  • Not giving error number exption ora-01772

  • You’re using OracleParameters in your OracleCommands?

Show 2 more comments

2 answers

1


According to this article in the original OS, there are several answers that can elucidate your problem: how-to-format-oraclenumber-generically

Here’s one I like:

alter session set NLS_NUMERIC_CHARACTERS='.,'
alter session set nls_date_format='YYYY-MM-DD HH24:MI:SS'

0

So it stays in format pt-BR and this is reflected in the other settings, especially in regional use:

Windows Form: Desktop Application

System.Threading.Thread.CurrentThread.CurrentCulture = New System.Globalization.CultureInfo("pt-BR")
System.Threading.Thread.CurrentThread.CurrentUICulture = New System.Globalization.CultureInfo("pt-BR")

Web: Forms or MVC Web Apllication

<system.web>
    <globalization uiCulture="pt-BR" culture="pt-BR"/>
</system.web>

With these settings it will configure your application with a regional behavior, being very important, because, you do not need to interfere in these conversions that are done automatically. I have web applications running on servers outside Brazil and this is of utmost importance.

  • I was able to solve the problem, just change the Oracle session

Browser other questions tagged

You are not signed in. Login or sign up in order to post.