janus1114 wrote:
I'm using XMLTextWriter to create a XML file from a database table.
I use WriteElementString to create elements. I'm having two issues:
1. When a data field is null, I get an error.
XMLTextWriter.WriteElementString("Name", dr("Name"))
What is dr exactly? What do you want to happen when the field is empty,
write an empty element?
2. When a data field is a date/timestamp field, I get an error.
What error? Can you call ToString e.g.
writer.WriteElementString("date", dr("Date").ToString())
to avoid the error?
In .NET 2.0 there are also methods to write typed data e.g.
<http://home.arcor.de/martin.honnen/javascript/2006/11/test2006111402.html>
in .NET 1.x you might want to use XmlConvert.
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/