日期:2014-05-20  浏览次数:20582 次

求教个路径问题!!!!!!!!!!!!!!!!!

为什么我用dstCust.WriteXml(Server.MapPath(path))系统提示path路径有问题
但换成dstCust.WriteXml(Server.MapPath( "bin/cs/cs.xml "))就没有问题

Dim   objConn   As   SqlConnection
                Dim   usern   As   String   =   "cs "
                Dim   path   As   String   =   HttpContext.Current.Server.MapPath( "bin/ "   +   usern   +   "/cs.xml ")
                Dim   strSql   As   String
strSql   =   "SELECT   *   FROM   test "
                objConn   =   New   SqlConnection(ConfigurationManager.AppSettings( "scon "))
                Dim   sdaCust   As   New   SqlDataAdapter(strSql,   objConn)
                Dim   dstCust   As   New   DataSet()
                sdaCust.Fill(dstCust,   "test ")
                dstCust.WriteXml(Server.MapPath(path))

------解决方案--------------------
Server.MapPath是web应用程序 的根路径
------解决方案--------------------
Dim path As String = HttpContext.Current.Server.MapPath( "bin/ " + usern + "/cs.xml ") dstCust.WriteXml(Server.MapPath(path)) 用了两次MapPath