我遇到了问题:"外部表格不符合预期格式"我尝试了各种修复方法。从Jet更改为Ace,安装Access数据库引擎作为方便Ace的方法,我已将扩展属性从8.0更改为12.0,反之亦然。还有其他人可以建议的其他修正吗?
private void button7_Click_2(object sender, EventArgs e)
{
string path = " \"C:\\Users\\jdavis\\Downloads\\Pharmacies\\CrossReferencing v3\\CrossReferencing\\bin\\Debug\\cross_check.xls\" ";
OleDbConnection con = new OleDbConnection("Provider=Microsoft.Ace.OLEDB.12.0;Data Source=" + path + ";Extended Properties= Excel 12.0;");
OleDbCommand command = new OleDbCommand( "SELECT *FROM [cross_check]",con);
DataSet cross = new DataSet();
OleDbDataAdapter adapter = new OleDbDataAdapter(command);
adapter.Fill(cross);
dataGridView2.DataSource = cross.Tables[0];
}
}