The Media Center Sandbox

Resources and discussion for developing experiences in the Windows Media Center platform.
Welcome to The Media Center Sandbox Sign in | Join | Help
in Search

DataSets

Last post 08-04-2009, 11:08 AM by David Wright. 0 replies.
Sort Posts: Previous Next
  •  08-04-2009, 11:08 AM 9302

    DataSets

    Using the Z application as an example, I am trying to figure out how to write a new entry in the tbl_Movies.xml via the dataset.  However, everytime I try, it seems to be writing the new entry outside of the dataroot.

    -----------------------------------------------------------------------------------

    XML:

    -----------------------------------------------------------------------------------

    <root>

      <dataroot>

        <tbl_Movie>

          ...

       </tbl_Movie>                      <--- Existing entries (all fine there)

       ...

       ...

       ...

      </dataroot>

      <tbl_Movie>

      ...                                 <--- New entry (being written outside of dataroot)

      </tbl_Movie>

    </root>

    -----------------------------------------------------------------------------------

    C#:

    -----------------------------------------------------------------------------------

    DataTable table = dataset.Tables["tbl_Movies"];

    DataRow row = table.NewRow();

    row[".."] = ...;

    row[".."] = ...;

    ...

    table.Rows.Add(row);

    table.AcceptChanges();

    -----------------------------------------------------------------------------------

    I have also tried table.Rows.InsertAt(row, 0);    but either way the new entry is being written outside the dataroot.

     

    How should I write this so that the new entry is written inside the dataroot?

    Thanks in advance


View as RSS news feed in XML
Powered by Community Server, by Telligent Systems