HighTechTalks DotNet Forums  

DataSet.ReadXml Method does not read/load space

Dotnet XML microsoft.public.dotnet.xml


Discuss DataSet.ReadXml Method does not read/load space in the Dotnet XML forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
=?Utf-8?B?bXJjc2hhcnBtYW4=?=
 
Posts: n/a

Default DataSet.ReadXml Method does not read/load space - 08-14-2007 , 05:36 PM






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;
--------------------------------------


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.