Excel imported OK on server A but screwed up on server B? RRS feed

  • Question

  • Hi there,

    I hope I'm posting into right forum...I think it's more server than code related thing....anyhow, I have  this application that reads data from excel file and (beside "doing something with this data") displays the excel values in table on web page.

    My problem is that on some servers decimals are detected OK and on others aren't. The weirdest thing is that, gor e.g. ,on Windows XP SP2 (IIS + .net 2) and default configuration (so nothing changed!) works but on SAME config (XP SP2, default IIS + .net) with office 2k3 it doesn't. On mono (linux server) results are same as on non-working windows config. And it's not just two or three, but I've tried like 5 or 6 different "servers" with (at least for me) illogical results. It works or it doesn't on almost same machines :-S

    My first thought was that it was locale's fault but it wasn't- the results were the same no matter what system locale settings I chose.

    OK, here's more detailed info.
    Pictures first (somehow they got "eaten" so I just put links)

    Excel file (only fist line) screenie

    "OK" server displays it as

    And non-working as: (note values for years 2007-2009!)

    As it can be seen, both servers have english (US) locale and therefore dot (.) as decimal separator while my local machine has slovene locale and therefore comma (,) separator. I tried changing it on server but it does not have any effect.

    Here's what's used in the code to load  data from excel:

    strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" +
                    "Data Source=" + HttpContext.Current.Server.MapPath(@"~\Upload\Excel\" + filename) +
                    ";Extended Properties=" + extProperty + ";";

                //You must use the $ after the object you reference in the spreadsheet
                OleDbDataAdapter oleDbDataAdapter = new OleDbDataAdapter(
                    "SELECT * FROM [" + workSheet + "$]", strConn);

    So, does anyone have any ideas where the problem could be?

    Friday, February 15, 2008 8:41 AM

All replies

  • Hi,


    I have the same problem. My servers are configured with the same Regional Settings and I cannot find a way to make Jet return data in a specific locale in one of them, in my case (en-US).

    1. The servers have the same Regional Settings (en-US)
    2. Excel is getting its locale configuration from system.
    3. I have already tried setting mannually the International information in Excel Options

     None of these procedures make the DataRow returned from Jet return number in English.


    The machine that is causing problems was originnaly installed in another language and I have changed the Regional Settings to english after. The server that is working was originally installed in English.


    There is somewhere a file configuring the JET with a specific Regional Settings and I cannot find it.


    Can you help us ???

    Friday, February 15, 2008 12:51 PM
  • Are there really NO ideas where to look for the problem or at least how to avoid it? :-(

    Sunday, February 17, 2008 12:16 PM