473,385 Members | 1,396 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,385 software developers and data experts.

Autoincrement in XML files

Hi All, I have an xml file which is constrained to a schema

Part of the schema shown below:

<xs:element name="ID" type="xs:int" msdata:AutoIncrement="true"
msdata:AutoIncrementSeed="1" />
<xs:element name="PersonName" type="xs:string" />

What I do is create a new datarow in the DataSet (The dataset is contains a
single datatable read from the XML file) and then using the DataSet.WriteXML
method I write the data back to the original XML file.
Everything works fine except that the ID element is not written to the XML
file and is certainly not incremented.
I have googled and come across various methods that involve creating a new
Datatable but this seems a bit extreme as there is already a datatable in
the dataset. The dataset contains information retrieved from an XML table
which in turn is based on an XML schema (See above).

I am probably just missing something somewhere in the process but cannot
figure out what

Any help appreciated
Regards
John

Jul 21 '05 #1
2 5260
John,

Did you make from ID a primairy key.

http://msdn.microsoft.com/library/de...ryKeyTopic.asp

By the way, you cannot write your databack doing writeXML you just overwrite
it. Therefore it is better to make a tempory file before you do that from
the old one and delete that when the operation is for sure correct
completed.

I hope this helps?

Cor

"John" <do**@spam.me>
Hi All, I have an xml file which is constrained to a schema

Part of the schema shown below:

<xs:element name="ID" type="xs:int" msdata:AutoIncrement="true"
msdata:AutoIncrementSeed="1" />
<xs:element name="PersonName" type="xs:string" />

What I do is create a new datarow in the DataSet (The dataset is contains
a
single datatable read from the XML file) and then using the
DataSet.WriteXML
method I write the data back to the original XML file.
Everything works fine except that the ID element is not written to the XML
file and is certainly not incremented.
I have googled and come across various methods that involve creating a new
Datatable but this seems a bit extreme as there is already a datatable in
the dataset. The dataset contains information retrieved from an XML table
which in turn is based on an XML schema (See above).

I am probably just missing something somewhere in the process but cannot
figure out what

Any help appreciated
Regards
John

Jul 21 '05 #2
Thanks Cor, I will take a look
Regards
John
"Cor Ligthert" <no************@planet.nl> wrote in message
news:uu**************@TK2MSFTNGP09.phx.gbl...
John,

Did you make from ID a primairy key.

http://msdn.microsoft.com/library/de...ryKeyTopic.asp
By the way, you cannot write your databack doing writeXML you just overwrite it. Therefore it is better to make a tempory file before you do that from
the old one and delete that when the operation is for sure correct
completed.

I hope this helps?

Cor

"John" <do**@spam.me>
Hi All, I have an xml file which is constrained to a schema

Part of the schema shown below:

<xs:element name="ID" type="xs:int" msdata:AutoIncrement="true"
msdata:AutoIncrementSeed="1" />
<xs:element name="PersonName" type="xs:string" />

What I do is create a new datarow in the DataSet (The dataset is contains a
single datatable read from the XML file) and then using the
DataSet.WriteXML
method I write the data back to the original XML file.
Everything works fine except that the ID element is not written to the XML file and is certainly not incremented.
I have googled and come across various methods that involve creating a new Datatable but this seems a bit extreme as there is already a datatable in the dataset. The dataset contains information retrieved from an XML table which in turn is based on an XML schema (See above).

I am probably just missing something somewhere in the process but cannot
figure out what

Any help appreciated
Regards
John


Jul 21 '05 #3

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

Similar topics

4
by: jaYPee | last post by:
I have a table in my sqlserver 2000 that has a field IDNO. i want this field to be my primary key. however i don't want this field to use the autoincrement feature. when i access this table from...
0
by: Marko Maehner | last post by:
Hi, I have a strange problem with my xml file. In the schema of this xml file I have set one column to autoincrement. When I enter the data in my xml file directly, the autoincrement-column gets...
0
by: Neil | last post by:
Hi, I'm getting some strange results using the autoincrement column on my datatable. I'm populating a datatable with data from my database and displaying this in a datagrid. The first time I get...
6
by: Dennis | last post by:
I have set a DataTable and one of the columns I set "AutoIncrement" to True. I then populate the Table by setting the columns to values then add the row to the table. I inadverently set the...
6
by: Michael | last post by:
I am trying to create an access database within Net 2003 using the ADOX library which works fine except when I try to add the AutoIncrement property to the ContactId column. I am experiencing a...
5
by: JC Voon | last post by:
Hi: How to reset the autoincrement value generated by DataTable ? I've master and detail table, the detail table has a autoincrement column, each time i add a new master record, i need to...
2
by: John | last post by:
Hi All, I have an xml file which is constrained to a schema Part of the schema shown below: <xs:element name="ID" type="xs:int" msdata:AutoIncrement="true" msdata:AutoIncrementSeed="1" />...
4
by: Tim | last post by:
Hello All, I could use some help on an error that is just now popping it's head up. Seems that the autoincrement numeric has hit 32,767. The autoincrement is used in various locations in the...
1
rizwan6feb
by: rizwan6feb | last post by:
I have a DataTable with thousands of records, i want to show these records on per page basis ( i.e a DataGridView showing first 20 records and next button to show next 20 records ...) To achieve...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.