在Sheet Excel中没有给出一个或多个必需参数的值

当我想在C#应用程序中导入表格excel时出现错误,

错误是“ 没有给出一个或多个所需参数的值 ”。

我使用MS Excel的C#。 这是我的代码

OpenFileDialog openFileDialog1 = new OpenFileDialog(); openFileDialog1.FileName = ""; openFileDialog1.Filter = "Excel File Sheet |*.xls; *.xlsx"; try { if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK) { string path = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + openFileDialog1.FileName + ";Extended Properties=\"Excel 8.0;HDR=Yes;\";"; OleDbConnection conn = new OleDbConnection(path); OleDbDataAdapter da = new OleDbDataAdapter("SELECT Date, PF, [Agent Name], TL, Supervisor, [Sum Under], [Sum Over], [Out of Adherence], Sch, Sum([Out of Adherence %]*100), Sum((100-(100*[Out of Adherence %]))) AS [Adherence % Daily] FROM [Sheet1$] GROUP BY Date, PF, [Agent Name], TL, Supervisor, [Sum Under], [Sum Over], [Out of Adherence], Sch, [Out of Adherence %]", conn); DataTable dt = new DataTable(); da.Fill(dt); dataGridView1.DataSource = dt; } else return; } catch(FieldAccessException ex) { MessageBox.Show("ERROR" + ex); } 

请帮我解决这个错误,

感谢你所做的一切..

这个错误通常是指您的select语句中缺less或拼写错误的值。

仔细检查所有列名称。