469,889 Members | 1,110 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,889 developers. It's quick & easy.

DataSet.ReadXml Method does not read/load space

Hello,

There is a space(as a data) in one of the columns. And i save my DataTable
as a xml file using DataSet. I used DataSet.WriteXml method to save as a xml
file. Now if I read that .xml file using DataSet.ReadXml method,it removes
space in that DataTable. Any idea...?
This does not work in Visual Studio .NET 2003. If I execute this in VS .Net
2005, it works. I must make it work in VS 2003.

Here there is a sample that does not work in VS NET 2003:
__________________________________________________ ______________________________

DataTable dbTable = new DataTable();
dbTable.Columns.Add(new DataColumn("MyColumn1",
Type.GetType("System.String")));

DataRow dbRow = dbTable.NewRow();
dbRow["MyColumn1"] = " ";
dbTable.Rows.Add(dbRow);

Console.WriteLine("Value = " + dbTable.Rows[0][0]);

DataSet dbSet = new DataSet();
dbSet.Tables.Add(dbTable);
dbSet.WriteXml("C:\\MyFile.xml", XmlWriteMode.WriteSchema);

dbRow = null;
dbTable = null;
dbSet = null;

DataSet dbReadSet = new DataSet();
dbReadSet.ReadXml("C:\\MyFile.xml", XmlReadMode.Auto);

Console.WriteLine("Value = " + dbReadSet.Tables[0].Rows[0][0]);

dbReadSet = null;
--------------------------------------

Aug 14 '07 #1
0 3131

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by jaime | last post: by
11 posts views Thread by Brian W. Smith | last post: by
22 posts views Thread by Arne | last post: by
3 posts views Thread by P K | last post: by
3 posts views Thread by David P. Donahue | last post: by
4 posts views Thread by Thiago Macedo | last post: by
1 post views Thread by Waqarahmed | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.