现在正在做一个网站,
开发环境为:Windowns Server 2003 企业版 + MS SQL Server 2000 企业版, .NET Framewrok 1.1。(全为中文版)
部署环境同上,但操作系统改为英文版。出现问题如下:
对于货币字段,我使用用decimal类型,在开发环境里正常运行,但在部署环境中,使用string.Format("{0:F2}", 123.45)时,得到的结果是“123,45”(小数点变成逗号了);检查过操作系统的标准格式为 Chinese(PRC);同时,在输入框中输入123.45,程序在把它转为decimal里,也会出现转换错误的提示。是什么原因?如何解决?thank you.

解决方案 »

  1.   

    怀疑是Web服务器问题,我写一个桌面程序,放在这台服务器上运行,很正确,可以显示为123.45,把字符串 "123.45"转为decimal 也没出错。
    哪位老大有遇过这种问题呀?帮帮忙。
      

  2.   

    TO:xupc(寻巢鸟) :是指哪里的区域选项呀?操作系统还是数据库?系统里我已经检查过了,是Chinese(PRC).
      

  3.   

    经过测试,应该是IIS的问题,因为桌面程序在上面运行没有这种情况,页使用Web程序时,就会把小数点变成逗号。
      

  4.   

    在Global.asax.cs文件中Application_BeginRequest事件加入,不知道对不对你试试吧!!protected void Application_BeginRequest(Object sender, EventArgs e)
    {
    try
    {
    if (Request.UserLanguages != null)
    Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(Request.UserLanguages[0]);
    else
    // Default to English if there are no user languages
    Thread.CurrentThread.CurrentCulture = new CultureInfo("zh-CN"); Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture;
    }
    catch (Exception ex)
    {
    Thread.CurrentThread.CurrentCulture = new CultureInfo("zh-CN");
    }
    }
      

  5.   

    或者在web.config文件
    <configuration>
       <system.web>
          <globalization
               fileEncoding="utf-8"
               requestEncoding="utf-8"
               responseEncoding="utf-8"
               culture="zh-CN"
               uiCulture="zh-CN"
            />
       </system.web>
    </configuration>