首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

Microsoft Access 数据库发动机找不到对象“c:\windows\system32\inetsrv\user1.xlsx”

2013-07-16 
Microsoft Access 数据库引擎找不到对象“c:\windows\system32\inetsrv\user1.xlsx”。Microsoft Access 数据

Microsoft Access 数据库引擎找不到对象“c:\windows\system32\inetsrv\user1.xlsx”。
Microsoft Access 数据库引擎找不到对象“c:\windows\system32\inetsrv\user1.xlsx”。请确保该对象存在,并正确拼写其名称和路径名。如果“c:\windows\system32\inetsrv\user1.xlsx”不是本地对象,请检查网络连接或与服务器管理员联系。
private DataSet ExcelData(string filepath,string filename)
        {

            string strConn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + filename + ";Extended Properties="Excel 12.0;HDR=yes;IMEX=1;"";
            OleDbConnection oleConn = new OleDbConnection(strConn);
            oleConn.Open();//这个地方报错是什么原因
            string olestr = "select * from [Sheet1$]";
            OleDbCommand oleComm = new OleDbCommand(olestr, oleConn);
            oleComm.Connection = oleConn;
            OleDbDataAdapter oleDa = new OleDbDataAdapter();
            oleDa.SelectCommand = oleComm;
            DataSet ds = new DataSet();
            oleDa.Fill(ds);
            oleConn.Close();
            return ds;

        }
还有下面这段代码,有问题吗?
                        string Path = Server.MapPath("Excel");
                    fileloads.PostedFile.SaveAs(Path + "\" + filename);
                    murl = (Path + "\" + filename).ToString();


[解决办法]
filename 的值是一个文件名吧?传一个完整的路径

[解决办法]
你跟踪调试一下,不就可以看到path的真实路径了吗? 
[解决办法]
没有“c:\windows\system32\inetsrv\user1.xlsx“这个文件
你的filename要是物理路径
[解决办法]
方法参数  (string filepath,string filename)

E.OLEDB.12.0;Data Source=" + filename + ";Extended Propert
为何只是filename  
应是 filepath+@""+filename 吧
[解决办法]
“c:\windows\system32\inetsrv\user1.xlsx”找不到这个文件,路径不对,在路径这下手

热点排行