我的源代码:
System.Data.DataTable UMCIT = new System.Data.DataTable();
string conn = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\\test.xls;Extended Properties='Excel 8.0;HDR=Yes;IMEX=1'";
System.Data.OleDb.OleDbConnection MyConnection = new System.Data.OleDb.OleDbConnection(conn);
System.Data.OleDb.OleDbDataAdapter MyCommand = new System.Data.OleDb.OleDbDataAdapter("select * from [VariantsData$]", MyConnection);
MyConnection.Open();
MyCommand.Fill(UMCIT);
MyConnection.Close();
MyCommand = null;
MyConnection = null;
报错:
The Microsoft Jet database engine could not find the object 'C:\test.xls'. Make sure the object exists and that you spell its name and the path name correctly.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.OleDb.OleDbException: The Microsoft Jet database engine could not find the object 'C:\Creat.xls'. Make sure the object exists and that you spell its name and the path name correctly.
请各位高手帮帮忙!
改成下面这个样子也是不行的,同样报一样的错,文件就再我的C:里
string conn = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\test.xls;Extended Properties='Excel