I need a workaround for Excel Guessing Data Types problem

后端 未结 4 970
忘掉有多难
忘掉有多难 2020-12-03 16:13

I\'m creating a utility to import data from Excel to Oracle database,

I have a fixed template for the excel file,

Now, when I\'m trying to import the data by J

4条回答
  •  醉梦人生
    2020-12-03 16:26

    This isn't completely right! Apparently, Jet/ACE ALWAYS assumes a string type if the first 8 rows are blank, regardless of IMEX=1, and always uses a numeric type if the first 8 rows are numbers (again, regardless of IMEX=1). Even when I made the rows read to 0 in the registry, I still had the same problem. This was the only sure fire way to get it to work:

    try
    {
        Console.Write(wsReader.GetDouble(j).ToString());
    }
    catch   //Lame unfixable bug
    {
        Console.Write(wsReader.GetString(j));
    }
    

提交回复
热议问题