locked
Problem reading from excel fields formated as number RRS feed

  • Question

  • User-1305073333 posted

    Hi, i am using Microsoft.Jet.OLEDB.4.0 to read data from an excel file, but when in the excel file there are fields formated as number the are not readed from the OldDb. What can i do to get this values, the problem exists when inserting new rows where excel choose the format itself.

    The connection string is:

     connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + filePath + ";Extended Properties=Excel 8.0;";

    I get data using this code:

                    conn = new OleDbConnection(connectionString);
                    conn.Open();

                    string strSQL = string.Format("SELECT * FROM  [{0}]", 'sheetName');

                    //esegue la query
                    OleDbDataAdapter adapter = new OleDbDataAdapter(strSQL, connectionString);
                    adapter.Fill(ExTable);

    Watching the row with values from numeric fields they are not valorized.

    Thanks.


    Monday, September 26, 2011 10:03 AM

All replies

  • User3866881 posted

    Hello ermal1981:)

    Show us your screenshots of your Excel files as well as your results.

    Compare them with each other Maybe we can analyze them....

    Thx again

    Tuesday, September 27, 2011 9:46 PM