恍惚之间

梦...

循环修改WEB.CONFIG

For Each Node In XmlDocument.Item("configuration").Item("appSettings")
                If Node.Name = "add" Then
                    If Node.Attributes.GetNamedItem("key").Value = "SQLConnString" Then
                        '写入连接字符串
                        Node.Attributes.GetNamedItem("value").Value = 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
                    If Node.Attributes.GetNamedItem("key").Value = "ConnectionString" Then
                        '写入连接字符串
                        Node.Attributes.GetNamedItem("value").Value = 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

posted on 2006-11-23 20:49  Red Hu  阅读(...)  评论(...编辑  收藏

My Links

Blog Stats