473,396 Members | 1,678 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Updating XML through strongly typed dataset

Hi all,

I have an xml file that I load into a strongly typed dataset via the ReadXML
method of the dataset. I then want to add a new row to the dataset and save
it back to disk.

Each row in the dataset is defined as an "entry", so I have a entryDataRow
member of my Entries dataset. However, I can't seem to figure out how to
create a new instance of an entryDataRow, modify it and add it to the
dataset. I can't find anything in my books, or MSDN about this subject...
maybe I am going about it the wrong way?

I'm used to doing this sort of thing for databases through a sqlDataAdapter,
and using "update" to modify the datasource, but I don't get how to have an
adapter to the XML file.

Your help is greatly appreciated!

-D

psudo - code of what I'm wanting to do:

dim ds as new Entries
ds.readXML("theXMLFile.xml")
dim dr as new Entries.entryRow
dr.item1 = "blah"
dr.Item2 = "blah"
ds.rows.add(dr)
ds.saveXML("theXMLFile.xml")
Nov 15 '05 #1
2 2636
Hi Big,

DataRow is part of a DataTable and not of a DataSet.
You should do something like
YourDataSet.entriesDataRow row = dataset.table.NewentriesRow();
row.Item1 = ...
....
dataset.table.AddentriesRow(row);

--
Miha Markic - RightHand .NET consulting & development
miha at rthand com

"Big D" <a@a.com> wrote in message
news:el**************@TK2MSFTNGP09.phx.gbl...
Hi all,

I have an xml file that I load into a strongly typed dataset via the ReadXML method of the dataset. I then want to add a new row to the dataset and save it back to disk.

Each row in the dataset is defined as an "entry", so I have a entryDataRow
member of my Entries dataset. However, I can't seem to figure out how to
create a new instance of an entryDataRow, modify it and add it to the
dataset. I can't find anything in my books, or MSDN about this subject...
maybe I am going about it the wrong way?

I'm used to doing this sort of thing for databases through a sqlDataAdapter, and using "update" to modify the datasource, but I don't get how to have an adapter to the XML file.

Your help is greatly appreciated!

-D

psudo - code of what I'm wanting to do:

dim ds as new Entries
ds.readXML("theXMLFile.xml")
dim dr as new Entries.entryRow
dr.item1 = "blah"
dr.Item2 = "blah"
ds.rows.add(dr)
ds.saveXML("theXMLFile.xml")

Nov 15 '05 #2
Cor
Hi BigD

As answer direct in your code asuming there is only one table in your XML
file

roughly typed.
\\\
dim ds as new dataset
ds.readXML("theXMLFile.xml") dim dr as datarow =ds.tables(0).newrow dr.item1 = "blah"
dr.Item2 = "blah" ds.tables(0).rows.add(dr) ds.saveXML("theXMLFile.xml")

///

I hope this helps a little bit?

Cor

Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: | last post by:
We have an object factory that returns weakly typed datasets (just plain ol' DataSet's). I need to cast it, or transform it, or map it to a strongly typed dataset. There's an old adage I heard...
2
by: theWizK | last post by:
Hello all. I have noticed that when I generate a strongly-typed dataset from an xml schema that the DataTables that are generated have their constructors marked as internal. What this means is...
1
by: Job Lot | last post by:
I am confused how strongly typed dataset is different from un-typed dataset. Is there any good link explaining pros and cons of both? Which one should be used preferably?
3
by: Duncan Welch | last post by:
I have a strongly typed dataset that returns two tables - "items" and "itemdetails". In the strongly-typed dataset designer, I've created a link (relationship) between the two tables based on a...
2
by: David | last post by:
I have been developing applications with Java for quite a while but I am new to .NET development. I am trying to learn the ".NET way" of creating Strongly Typed Objects from a database. The...
1
by: HardBap | last post by:
I've created a strongly typed DataSet (Customers.xsd) using the xsd.exe tool. I want to be able to access fields using ds.Customer.CompanyName. The problem is when I return this DataSet from a...
1
by: Andre Ranieri | last post by:
I'm designing an extranet web site that customers will use to log in and see their account history, make payments against their balance, etc. I've declared a strongly typed DataSet as a public...
2
by: =?Utf-8?B?UGV0ZXI=?= | last post by:
When I'm debugging a Windows Forms Application in VS2005 IDE, how can I check whether a dataset is strongly typed or not in Watch window? Are there some properties or methods only exist for...
4
by: Rachana | last post by:
Hi, I have understood Data Sets but what is meant by typed/untyped/ strongly typed datasets. Can any one explain me or suggest any site/ article, to get these concepts (and their ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.