Click here to Skip to main content
16,004,479 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to apply regional settings of server when uploading excel to oracle using asp.net coding. The problem with the date column in excel if it is defined character also.
Posted

1 solution

Before applying the regional settings of server, you need to retrieve the culture information. You can use the CurrentCulture to obtain the fresh values of the culture. Here is the sample code:

C#
class Program
{
    private class State
    {
        public CultureInfo Result { get; set; }
    }

    static void Main(string[] args)
    {
        Thread.CurrentThread.CurrentCulture.ClearCachedData();
        var thread = new Thread(
            s => ((State)s).Result = Thread.CurrentThread.CurrentCulture);
        var state = new State();
        thread.Start(state);
        thread.Join();
        var culture = state.Result;
        // Do something with the culture
    }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900