0

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();
            da.Fill(dt);

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.

1
Contributor
1
Reply
2
Views
5 Years
Discussion Span
Last Post by Cameronsmith63
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.