Imports System.Xml
Imports System.IO
Imports System.Data
Public Class Config_DB1ServerIP
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
Protected Sub cmdsave_click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdsave.Click
Dim DBServerIP As String
Dim DBUsername As String
Dim DBPassword As String
Dim DBDatabaseName As String
Dim DBTableName1 As String
Dim DBTableName2 As String
Dim DBTableName3 As String
Dim DBTableName4 As String
DBServerIP = DB1ServerIP1.Text
DBUsername = DB1Username1.Text
DBPassword = DB1Password1.Text
DBDatabaseName = DB1DatabaseName1.Text
DBTableName1 = DB1TableName11.Text
DBTableName2 = DB1TableName21.Text
DBTableName3 = DB1TableName31.Text
DBTableName4 = DB1TableName41.Text
If IO.File.Exists("Config.xml") = False Then
'declare our xmlwritersettings object
Dim settings As New XmlWriterSettings()
'lets tell to our xmlwritersettings that it must use indention for our xml
settings.Indent = True
'lets create the MyXML.xml document, the first parameter was the Path/filename of xml file
' the second parameter was our xml settings
Dim XmlWrt As XmlWriter = XmlWriter.Create("C:\Config.xml", settings)
With XmlWrt
' Write the Xml declaration.
.WriteStartDocument()
' Write the root element.
.WriteStartElement("configuration")
.WriteStartElement("DBServerIP")
' Start our first person.
'.WriteStartElement("Person")
' The person nodes.
'DB1ServerIP
'DB1Username
'DB1Password
'DB1DatabaseName
'DB1TableName1
'DB1TableName2
'DB1TableName3
'DB1TableName4
.WriteStartElement("DB1ServerIP")
.WriteString(DBServerIP)
.WriteEndElement()
.WriteStartElement("DB1Username")
.WriteString(DBUsername)
.WriteEndElement()
.WriteStartElement("DB1Password")
.WriteString(DBPassword)
.WriteEndElement()
.WriteStartElement("DB1DatabaseName")
.WriteString(DBDatabaseName)
.WriteEndElement()
.WriteStartElement("DB1TableName1")
.WriteString(DBTableName1)
.WriteEndElement()
.WriteStartElement("DB1TableName2")
.WriteString(DBTableName2)
.WriteEndElement()
.WriteStartElement("DB1TableName3")
.WriteString(DBTableName3)
.WriteEndElement()
.WriteStartElement("DB1TableName4")
.WriteString(DBTableName4)
.WriteEndElement()
' The end of this person.
.WriteEndElement()
' Close the XmlTextWriter.
.WriteEndDocument()
.Close()
End With
Response.Write("XML file saved.")
End If
End Sub
End Class
For Each desc In From element In catalog.<Catalog>.<Book>.<Description>
' Replace and preserve inner XML.
desc.ReplaceWith(<Abstract><%= desc.Nodes %></Abstract>)
Next
For Each price In From element In catalog.<Catalog>.<Book>.<Price>
' Replace with text value.
price.ReplaceWith(<MSRP><%= price.Value %></MSRP>)
Next