DataSet.ReadXml Method does not read/load space

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?bXJjc2hhcnBtYW4=?=

    #1

    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.WriteXm l 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("MyC olumn1",
    Type.GetType("S ystem.String")) );

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

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

    DataSet dbSet = new DataSet();
    dbSet.Tables.Ad d(dbTable);
    dbSet.WriteXml( "C:\\MyFile.xml ", XmlWriteMode.Wr iteSchema);

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

    DataSet dbReadSet = new DataSet();
    dbReadSet.ReadX ml("C:\\MyFile. xml", XmlReadMode.Aut o);

    Console.WriteLi ne("Value = " + dbReadSet.Table s[0].Rows[0][0]);

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

Working...