So now that im using excel 2010 and saving data in .xlsx format, I have a problem doing something very simple, like reading the file and trying to run a simple sql command on it...

SqlConnection con = new SqlConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Download Report Sheets\Schedule List\SoftwareDownload_OS732_20120306.xlsx;Extended Properties=Excel 12.0 Xml;HDR=YES");
            SqlDataAdapter da = new SqlDataAdapter("Select TERM_NR from [To be Scheduled$]", con);
            DataTable dt = new DataTable();

Anyone know how to read .xlsx?

Im used to reading csv files but a bit rusty now due to other more interesting programs that I have been working on.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.