xml问题:特急,请求答案!

njhyh njhyh 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
Dim FileInfo As System.IO.FileInfo = New System.IO.FileInfo("F:\安装包\WindowsApplication1\web.config")
Dim XmlDocument As New System.Xml.XmlDocument
XmlDocument.Load(FileInfo.FullName)
'查找到appSettings中的节点
Dim Node As System.Xml.XmlNode
Dim FoundIt As Boolean = False
For Each Node In XmlDocument.Item("configuration").Item("appSettings")
If Node.Name = "add" Then
If Node.Attributes.GetNamedItem("key").Value = "connString" Then
'写入连接字符串
Node.Attributes.GetNamedItem("value").Value = "44444" 'String.Format("Persist Security Info=False;Data Source={0};Initial Catalog={1};User ID={2};Password={3};Packet Size=4096;Pooling=true;Max Pool Size=100;Min Pool Size=1", _
'Me.Context.Parameters.Item("server"), Me.Context.Parameters.Item("dbname"), Me.Context.Parameters.Item("user"), Me.Context.Parameters.Item("pwd"))
FoundIt = True
End If
End If
Next Node
执行这段代码的时候,走到Node.Attributes.GetNamedItem("key").Value = "connString"这里的时候老是提示:
未处理的“System.NullReferenceException”类型的异常出现在 WindowsApplication1.exe 中。

其他信息: 未将对象引用设置到对象的实例。

请问:我哪个地方用的不对!请求答案.在线!
...全文

相关推荐

评论 4
收藏 已收藏
分享
返回顶部
njhyh
VB 16,718 成员 110,520 内容