PDA

View Full Version : oledbexception 0x80004005 external table is not in the expected format



big_elite
شنبه 28 آذر 1394, 09:32 صبح
با سلام خدمت دوستان
من آفیس 2016 دارم و ویژوال استادیو 2013
میخوام به فایل اکسل توی برنامه یه سلولش رو بخونم اما نمیشه
این ارور رو میده
oledbexception 0x80004005 external table is not in the expected format


درضمن برنامه من هم اینجوری مقدار دهی شده :

System.Data.OleDb.OleDbConnection myconnection; System.Data.OleDb.OleDbDataAdapter mycommand;
string path = @txtAddress.Text;


myconnection = new System.Data.OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + path + ";Extended Properties=Excel 16.0;");
mycommand = new System.Data.OleDb.OleDbDataAdapter("select * from [a$]", myconnection);
mycommand.TableMappings.Add("Table", "TestTable");


mycommand.Fill(dtset);
dataGridView1.DataSource = dtset.Tables[0];
myconnection.Close();


ممنون میشم راهنمایی بفرمایید.

big_elite
شنبه 28 آذر 1394, 14:09 عصر
توی برنامم اکسل با پسوند XLS رو میخونه
اما XLSX که لود میکنم اررور میده 137524