本文介绍了将.xlsx(2007)读入.xml的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好
我写了这段代码,但是有错误:
I wrote this code, but I have Error:
private void button4_Click(object sender, EventArgs e) { var fileName = Application.StartupPath + @"\Book1.xlsx"; var connectionString = string.Format("Provider=Microsoft.Jet.OLEDB.4.0; data source={0}; Extended Properties=Excel 8.0;", fileName); var adapter = new OleDbDataAdapter("SELECT * FROM [Sheet1]", connectionString); var ds = new DataSet(); adapter.Fill(ds,"Sheet1"); DataTable data = ds.Tables["Sheet1"]; data.WriteXml(Application.StartupPath + @"\sample.xml"); }
推荐答案
请提供更多信息.您有什么错误?
Pleas provide more information. What is the error you have?
Rgds MM
这篇关于将.xlsx(2007)读入.xml的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!