Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi.

 

My goal here is to import an xml file into my sql server database. (I'm semi new to using xml)

 

First, I am importing the xml file into a dataset using ReadXml. When I first did this, I would bind a datagrid to the dataset, and it worked great, but it was in a hierchechal style view....with plus symbols etc that would expand the records into more detailed information. This isn't really what I wanted, I just want to import all the info into a single table....but, I discovered that the dataset actually consists of 14 different tables after I import the xml file.

 

Theoretically, this would be fine, I can just create 14 tables in my database...(or create my own table with what i want in code) but what I'm mega confused about is that some of the tables have no relational field whatsoever to the other tables. So I do not understand how the data tables in my dataset relate to each other. (i created 14 datagrids on a form and populated them all with thier respective table from the dataset, and there is no field displayed to relate them). I assume this is because the dataset was created from xml and somehow it knows how they are related...but I don't know how to access that information.

 

Anyway, how do I relate these 14 tables in my dataset together so I can populate tables in my database and be able to use them? (I thought of adding a field to each table in code and relate them that way, but that wont work as I wont be able to relate it in my code either :)) What am I missing here? thanks much, I do appreciate any assistance.

 

-JBD

Posted
Theoretically' date=' this would be fine, I can just create 14 tables in my database...(or create my own table with what i want in code) but what I'm mega confused about is that some of the tables have no relational field whatsoever to the other tables. So I do not understand how the data tables in my dataset relate to each other. (i created 14 datagrids on a form and populated them all with thier respective table from the dataset, and there is no field displayed to relate them). I assume this is because the dataset was created from xml and somehow it knows how they are related...but I don't know how to access that information.[/quote']

 

Ok, so I can't really answer your questions, but I know DataSets have a Relations property which is a DataRelationCollection class that "contains a collection of DataRelation objects; otherwise a null value if no DataRelation objects exist." Perhaps you could investigate this further to see if any relations were automatically generated?

 

DataSet Relations Property (.NET Framework)

Posted
Ok, so I can't really answer your questions, but I know DataSets have a Relations property which is a DataRelationCollection class that "contains a collection of DataRelation objects; otherwise a null value if no DataRelation objects exist." Perhaps you could investigate this further to see if any relations were automatically generated?

 

DataSet Relations Property (.NET Framework)

Hi thanks. I figured it out. basically I wrote the xml schema into a multiline text box using writexmlschema in the dataset. I then copied and pasted that schema into the xml designer of visual studio, and it gave me the layout of all the tables in the dataset. I found that the columns that related them were hidden...so, anyway, I created tables that matched in my database and I update the data tables right from the dataset. It works great, thanks :)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...