XmlDocument

Public Function Conn() Dim doc As New XmlDocument() '这儿原来是写doc.LoadXml("config.xml"),但发现它访问文件的根目录是从bin下就是生成的动态文件处开始的,我要是把文件放到bin下就能找到。有人能解释下吗? doc.LoadXml("../../config.xml") Dim nodeRoot = doc.DocumentElement Dim sConn As String Dim sDb As String Dim sUserid As String Dim sPwd As String sConn = nodeRoot.SelectSingleNode("datasouce").InnerText sDb = nodeRoot.SelectSingleNode("database").InnerText sUserid = nodeRoot.SelectSingleNode("userid").InnerText sPwd = nodeRoot.SelectSingleNode("password").InnerText Dim sConnection As String sConnection = "data source=" + sConn + ";initial catalog=" + sDb + ";uid=" + sUserid + ";pwd=" + sPwd Return sConnection End Function 出错: doc.LoadXml("../../config.xml") vb傻瓜式的提示什么也没有。大家看我这段代码有问题吗?
阅读更多
个人分类: XML
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭