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();

解决方案 »

  1.   

    filename 的值是一个文件名吧?传一个完整的路径
      

  2.   

    你跟踪调试一下,不就可以看到path的真实路径了吗? 
      

  3.   

    没有“c:\windows\system32\inetsrv\user1.xlsx“这个文件
    你的filename要是物理路径
      

  4.   

    这个c:\windows\system32\inetsrv目录好像是IIS默认的目录
      

  5.   

              string fullfilename = fileloads.PostedFile.FileName; ;// 客户端文件路径
                string filename = fullfilename.Substring(fullfilename.LastIndexOf("\\") + 1);
               
      

  6.   

    方法参数  (string filepath,string filename)E.OLEDB.12.0;Data Source=" + filename + ";Extended Propert
    为何只是filename  
    应是 filepath+@"\"+filename 吧
      

  7.   

    “c:\windows\system32\inetsrv\user1.xlsx”找不到这个文件,路径不对,在路径这下手