none
The 'Microsoft.ace.oledb.4.0' provider is not registered on the local machine.

    Question

  • Hello,


    I developed a .net application in visual studio 2010, in this i am trying to convert a csv file into datatable using oledb, it works fine when i run it locally but causing a hell problem when deployed in IIS which is on machine with 64-bit.

    I looked over this issue in many forums, and tried it by changing the connection string to The 'Microsoft.ace.oledb.12.0' provider but still it doesn't work and displays the same error accordingly, i tried changing the application pool too to enable 32-bit but it also did not help.

            #region Method to get datatable of exported CSV File
            public static DataTable GetDataTable(string csvFilePath)
            {
                string connString = string.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended Properties=Text;", Path.GetDirectoryName(csvFilePath));

    // tried it this way too

    (  //string con = string.Format("Provider=Microsoft.ACE.OLEDB.12.0; Data Source={0};Extended //Properties=Text;",Path.GetDirectoryName(filename));            string cmdString = string.Format("SELECT * FROM {0}", //Path.GetFileName(csvFilePath));    )

                DataTable dt = new DataTable();
                using (OleDbConnection conn = new OleDbConnection(connString))
                {
                    conn.Open();
                    OleDbDataAdapter adapter = new OleDbDataAdapter();
                    adapter.SelectCommand = new OleDbCommand(cmdString, conn);
                    adapter.Fill(dt);
                    conn.Close();
                }
                return dt;
            }
            #endregion

    can you please help its urgent and running out of time.???

    Thursday, April 19, 2012 12:00 PM

Answers

All replies