Error: The Microsoft Jet database engine could not find the object when excel sheet name with number in ASP.Net

Last Reply one year ago By itsjayshah

Posted one year ago

Excel sheet name start with number is not working in



       OleDbConnection connection = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Excel + "; Extended Properties= \"Excel 8.0;HDR=Yes;IMEX=1\";");
        DataTable dt = connection.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
        if (dt != null)
            string[] excelSheets = new String[dt.Rows.Count];
            string sheetname;
            sheetname = "";
            foreach (DataRow row in dt.Rows)
                if (row["TABLE_NAME"].ToString().Contains("$"))
                    sheetname = row["TABLE_NAME"].ToString();

                    //Load the DataTable with Sheet Data so we can get the column header
                    OleDbCommand oconn = new OleDbCommand("select top 1 * from ["
                        +  sheetname  + StartingColumn + StartReadingFromRow + ":" + EndingColumn + "]", connection);
                    OleDbDataAdapter adp = new OleDbDataAdapter(oconn);
                    DataTable dtdata = new DataTable();


getting Error  This:-  


The Microsoft Jet database engine could not find the object ''9286$'A6:O'.  Make sure the object exists and that you spell its name and the path name correctly.

You are viewing reply posted by: itsjayshah one year ago.
Posted one year ago

No value given for one or more required parameters.