DatSet, XML and Type DataSet transfer data

G

Guest

Hi All

I'm developing ADO .NET application.

I have dataset inside my code and I write an XML file from my dataset.
After that, I write program test to create type dataset from that XML file. I create new type dataset and use ReadXml method to load data from an XML file but there is an error occur. I try to use normally dataset and use ReadXml method to load data, it success

Is there anybody can help me solve this problem?
Or introduce me what should I do if I need to use type dataset and an XML file with my program

Thanks
KP
 
K

Kevin Yu [MSFT]

Hi KPH,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that when you use ReadXml to import data
from an Xml file which was exported from an untyped DataSet, it fails.
However, if the target DataSet is an untyped one, it succeeded. If there is
any misunderstanding, please feel free to let me know.

Based on my experience, this might happen when the original data in the Xml
file doesn't meet the schema of the target typed DataSet. If there are
UniqueConstraint, ForeignKeyConstraint or PrimaryKey set in the target
DataSet, importing data which break these constraints can result in
exceptions.

So please check the schema of the typed DataSet. If that still doesn't
solve the problem, could you please paste your exception message here?

HTH. If anything is unclear, please feel free to reply to the post.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
G

Guest

Hi

Thank you for your advise

Yes I ceate xml file from untyped dataset. After that I create type dataset from that xml file with .NET IDE tool. So I try to read that xml file to typed dataset but no row affect. I change my typed dataset to untype dataset and try to read that xml file again, it work there are row in table of dataset

Why no row in my table of my typed dataset

Thanks
KPH
 
K

Kevin Yu [MSFT]

Hi KPH,

As I mentioned in my last post, the typed DataSet might contain some
constraints in the schema. Data which violates these constraints will not
be added. For example, if we have defined a primary key in a table. The
table already contains a row whose primary key is 1. When we are trying to
add another row which has the same primary key value, an error occurs. If
the problem persists, could you please paste your exception message here?
Or could you paste your DataSet schema and the Xml file here? Thanks for
your cooperation!

For more information about constraints, please check the following link.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/
frlrfsystemdataconstraintclasstopic.asp

If anything is unclear, please feel free to reply to the post.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top