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

xml to Database

EDI
I have a XML which needs to be placed into Database. I am using a typed
Dataset and command builder. I loaded the xml into dataset using readXML
method. Now I want to place it into Database. But the rowstate property
remains unchanged because of which Data Adapter is not updating any rows in
the table.

XmlDocument xmlD = new XmlDocument();
xmlD.Load(filePath);

TypedDataSet tds = new TypedDataSet();
tds.Fill(xmlD);

//Here the row status is unchanged.

How do I update rows into database with out having to create a new dataset
and manually load all rows one by one into it?
Nov 17 '05 #1
5 1744
EDI,

Are all of these adds? Depending on the version of .NET that you are
using, you will have two different options available to you.

If you are using .NET 1.1 or before, you will have to create a new data
set, with the same schema, but which is empty. You can then loop through
your loaded data set, calling the AddRow method on the DataRowCollection
returned from the Rows property on the new DataTable. This will cause the
RowState to be Added, which will cause the data adapter to insert new
records into the database.

If you are using .NET 2.0 (the beta), then you can cycle through all the
rows in your loaded table and call the SetAdded method on the row, which
will set the row state to Added, and then run that through the adapter.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"EDI" <EA*@EDI.com> wrote in message
news:OS**************@tk2msftngp13.phx.gbl...
I have a XML which needs to be placed into Database. I am using a typed
Dataset and command builder. I loaded the xml into dataset using readXML
method. Now I want to place it into Database. But the rowstate property
remains unchanged because of which Data Adapter is not updating any rows in
the table.

XmlDocument xmlD = new XmlDocument();
xmlD.Load(filePath);

TypedDataSet tds = new TypedDataSet();
tds.Fill(xmlD);

//Here the row status is unchanged.

How do I update rows into database with out having to create a new dataset
and manually load all rows one by one into it?

Nov 17 '05 #2
EDI
Thank you Nicholas,

I was trying to avoid looping. Now since there is no other way to do that, I
will go ahead with looping. Thank you for your quick response.


"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:%2****************@TK2MSFTNGP14.phx.gbl...
EDI,

Are all of these adds? Depending on the version of .NET that you are
using, you will have two different options available to you.

If you are using .NET 1.1 or before, you will have to create a new data
set, with the same schema, but which is empty. You can then loop through
your loaded data set, calling the AddRow method on the DataRowCollection
returned from the Rows property on the new DataTable. This will cause the
RowState to be Added, which will cause the data adapter to insert new
records into the database.

If you are using .NET 2.0 (the beta), then you can cycle through all
the rows in your loaded table and call the SetAdded method on the row,
which will set the row state to Added, and then run that through the
adapter.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"EDI" <EA*@EDI.com> wrote in message
news:OS**************@tk2msftngp13.phx.gbl...
I have a XML which needs to be placed into Database. I am using a typed
Dataset and command builder. I loaded the xml into dataset using readXML
method. Now I want to place it into Database. But the rowstate property
remains unchanged because of which Data Adapter is not updating any rows
in the table.

XmlDocument xmlD = new XmlDocument();
xmlD.Load(filePath);

TypedDataSet tds = new TypedDataSet();
tds.Fill(xmlD);

//Here the row status is unchanged.

How do I update rows into database with out having to create a new
dataset and manually load all rows one by one into it?


Nov 17 '05 #3
EDI
I generated a typed data set from a table. I am trying to insert a null
value into field of type decimal. Database wont rhow an error. But Dataset
rhows an exception. How do I insert a null value into that field..

I have the following

<xs:element name="XXX" type="xs:decimal" minOccurs="0" nillable="true" />
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:%2****************@TK2MSFTNGP14.phx.gbl...
EDI,

Are all of these adds? Depending on the version of .NET that you are
using, you will have two different options available to you.

If you are using .NET 1.1 or before, you will have to create a new data
set, with the same schema, but which is empty. You can then loop through
your loaded data set, calling the AddRow method on the DataRowCollection
returned from the Rows property on the new DataTable. This will cause the
RowState to be Added, which will cause the data adapter to insert new
records into the database.

If you are using .NET 2.0 (the beta), then you can cycle through all
the rows in your loaded table and call the SetAdded method on the row,
which will set the row state to Added, and then run that through the
adapter.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"EDI" <EA*@EDI.com> wrote in message
news:OS**************@tk2msftngp13.phx.gbl...
I have a XML which needs to be placed into Database. I am using a typed
Dataset and command builder. I loaded the xml into dataset using readXML
method. Now I want to place it into Database. But the rowstate property
remains unchanged because of which Data Adapter is not updating any rows
in the table.

XmlDocument xmlD = new XmlDocument();
xmlD.Load(filePath);

TypedDataSet tds = new TypedDataSet();
tds.Fill(xmlD);

//Here the row status is unchanged.

How do I update rows into database with out having to create a new
dataset and manually load all rows one by one into it?


Nov 17 '05 #4
EDI,

Are you trying to do it through code, or through the XML declaration in
the data set?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"EDI" <EA*@EDI.com> wrote in message
news:ud**************@TK2MSFTNGP12.phx.gbl...
I generated a typed data set from a table. I am trying to insert a null
value into field of type decimal. Database wont rhow an error. But Dataset
rhows an exception. How do I insert a null value into that field..

I have the following

<xs:element name="XXX" type="xs:decimal" minOccurs="0" nillable="true" />
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote
in message news:%2****************@TK2MSFTNGP14.phx.gbl...
EDI,

Are all of these adds? Depending on the version of .NET that you are
using, you will have two different options available to you.

If you are using .NET 1.1 or before, you will have to create a new
data set, with the same schema, but which is empty. You can then loop
through your loaded data set, calling the AddRow method on the
DataRowCollection returned from the Rows property on the new DataTable.
This will cause the RowState to be Added, which will cause the data
adapter to insert new records into the database.

If you are using .NET 2.0 (the beta), then you can cycle through all
the rows in your loaded table and call the SetAdded method on the row,
which will set the row state to Added, and then run that through the
adapter.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"EDI" <EA*@EDI.com> wrote in message
news:OS**************@tk2msftngp13.phx.gbl...
I have a XML which needs to be placed into Database. I am using a typed
Dataset and command builder. I loaded the xml into dataset using readXML
method. Now I want to place it into Database. But the rowstate property
remains unchanged because of which Data Adapter is not updating any rows
in the table.

XmlDocument xmlD = new XmlDocument();
xmlD.Load(filePath);

TypedDataSet tds = new TypedDataSet();
tds.Fill(xmlD);

//Here the row status is unchanged.

How do I update rows into database with out having to create a new
dataset and manually load all rows one by one into it?



Nov 17 '05 #5
EDI
I am trying using code. But both the ways are fine.
Thanks

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:%2***************@TK2MSFTNGP14.phx.gbl...
EDI,

Are you trying to do it through code, or through the XML declaration in
the data set?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"EDI" <EA*@EDI.com> wrote in message
news:ud**************@TK2MSFTNGP12.phx.gbl...
I generated a typed data set from a table. I am trying to insert a null
value into field of type decimal. Database wont rhow an error. But Dataset
rhows an exception. How do I insert a null value into that field..

I have the following

<xs:element name="XXX" type="xs:decimal" minOccurs="0" nillable="true" />
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote
in message news:%2****************@TK2MSFTNGP14.phx.gbl...
EDI,

Are all of these adds? Depending on the version of .NET that you are
using, you will have two different options available to you.

If you are using .NET 1.1 or before, you will have to create a new
data set, with the same schema, but which is empty. You can then loop
through your loaded data set, calling the AddRow method on the
DataRowCollection returned from the Rows property on the new DataTable.
This will cause the RowState to be Added, which will cause the data
adapter to insert new records into the database.

If you are using .NET 2.0 (the beta), then you can cycle through all
the rows in your loaded table and call the SetAdded method on the row,
which will set the row state to Added, and then run that through the
adapter.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"EDI" <EA*@EDI.com> wrote in message
news:OS**************@tk2msftngp13.phx.gbl...
I have a XML which needs to be placed into Database. I am using a typed
Dataset and command builder. I loaded the xml into dataset using readXML
method. Now I want to place it into Database. But the rowstate property
remains unchanged because of which Data Adapter is not updating any rows
in the table.

XmlDocument xmlD = new XmlDocument();
xmlD.Load(filePath);

TypedDataSet tds = new TypedDataSet();
tds.Fill(xmlD);

//Here the row status is unchanged.

How do I update rows into database with out having to create a new
dataset and manually load all rows one by one into it?



Nov 17 '05 #6

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

Similar topics

0
by: Cherrish Vaidiyan | last post by:
sir, The following are the steps that i followed in setting up standby database on Red hat Linux 9. i am using Oracle 9i. i have followed the steps in this site : ...
6
by: Marvin Libson | last post by:
Hi All: I am running DB2 UDB V7.2 with FP11. Platform is Windows 2000. I have created a java UDF and trigger. When I update my database I get the following error: SQL1224N A database...
8
by: Kamlesh | last post by:
Hi, How do I know the physical database path of a database. When I goto the DB2INSTANCE users's directory (/home/db2inst1), I see following folders: /db2inst1/NODE0000/SQL00001...
1
by: pintur | last post by:
The message is: SQL1036C Errore di I/O durante l' accesso al database. SQLSTATE=58030 what is the proble? what for restore tables? thanks
3
by: josh.kuo | last post by:
Sorry about the subject, I can't think of a better one. I recently wrote some PHP classes that I think might be of interest to this group. Since I have been reaping the benefits of reading news...
8
by: morleyc | last post by:
Hi, until recently i was quite happy to add data sources from mssql database in visual studio and drag the datasets directly onto the form this creating a directly editable form which worked well....
0
by: Jack | last post by:
Training Classes for Oracle10g, 9i, 8i Certification training in Oracle10g and 9i: DBA, Developer, Discoverer. training conducted at your location worldwide. Courseware licensing also available....
0
by: Winder | last post by:
Training Classes for Oracle10g, 9i, 8i Certification training in Oracle10g and 9i: DBA, Developer, Discoverer. training conducted at your location worldwide. Courseware licensing also available....
0
by: Laurynn | last post by:
# (ebook - pdf) - programming - mysql - php database applicati # (Ebook - Pdf)Learnkey How To Design A Database - Sql And Crystal Report # (ebook-pdf) E F Codd - Extending the Database Relational...
9
by: Peter Duniho | last post by:
Is there a straightfoward API in .NET that allows for inspection of a database? That is, to look at the structure of the database, without knowing anything in advance about it? For example,...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.