上载Excel时如何应用服务器的区域设置 [英] how to apply regional settings of server when uploading excel

查看:82
本文介绍了上载Excel时如何应用服务器的区域设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用asp.net编码将excel上传到oracle时如何应用服务器的区域设置.如果还定义了字符,则excel中的日期列也会出现问题.

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.

推荐答案

在应用服务器的区域设置之前,您需要检索区域性信息.您可以使用CurrentCulture获取文化的新价值.这是示例代码:

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:

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
    }


这篇关于上载Excel时如何应用服务器的区域设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆