G
Guoqi Zheng
Dear sir,
I am trying to use XmlTextWriter to create a xml file. It works ok, however
when I reexecute the aspx page again, it always give an error of
"The process cannot access the file "E:\mysite\html\td\product.xml" because
it is being used by another process"
My code is folliowing. Thanks in advanced!!
<mycode>
.....
Dim writer as XmlTextWriter = new XmlTextWriter(filename,Encoding.UTF8)
writer.Formatting = Formatting.Indented
Writer.WriteStartElement("productFeed", nothing)
Writer.WriteAttributeString("version", "0")
' loop the databet and write the elements.
Dim r as DataRow
For Each r in objDataset.Tables("Product").Rows
Writer.WriteStartElement("product")
Writer.WriteAttributeString("id", r("ProductId"))
Writer.WriteAttributeString("delete", "false")
Writer.WriteElementString("name", r("ProductName"))
Writer.WriteStartElement("ProductURL")
Writer.WriteCData(r("LinkUrl"))
Writer.WriteEndElement()
Writer.WriteEndElement()
Writer.Flush()
Next
Writer.WriteEndElement()
writer.close()
</mycode>
I am trying to use XmlTextWriter to create a xml file. It works ok, however
when I reexecute the aspx page again, it always give an error of
"The process cannot access the file "E:\mysite\html\td\product.xml" because
it is being used by another process"
My code is folliowing. Thanks in advanced!!
<mycode>
.....
Dim writer as XmlTextWriter = new XmlTextWriter(filename,Encoding.UTF8)
writer.Formatting = Formatting.Indented
Writer.WriteStartElement("productFeed", nothing)
Writer.WriteAttributeString("version", "0")
' loop the databet and write the elements.
Dim r as DataRow
For Each r in objDataset.Tables("Product").Rows
Writer.WriteStartElement("product")
Writer.WriteAttributeString("id", r("ProductId"))
Writer.WriteAttributeString("delete", "false")
Writer.WriteElementString("name", r("ProductName"))
Writer.WriteStartElement("ProductURL")
Writer.WriteCData(r("LinkUrl"))
Writer.WriteEndElement()
Writer.WriteEndElement()
Writer.Flush()
Next
Writer.WriteEndElement()
writer.close()
</mycode>