?
Solved

URGENT:: Xml Data Sets

Posted on 2003-11-20
14
Medium Priority
?
385 Views
Last Modified: 2013-11-19
So after I have created my typed dataset, how do I actually create a new row.  I can easily assign all of the atttibute for my row, but some of the attribute are complex types that are also in the data table, what do I actually assign to these values.  for example,

I have a contact, which as part of a complex type, includes mailing_information, which is itself a complex type.  how do I set the

contactRow.mailing_information field, what should actually go into ti?  I can somehow pass it the raw xml?

The way contactRow is getting creating is by a call to the table that has contactRows.  
0
Comment
Question by:jjacksn
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
14 Comments
 
LVL 18

Expert Comment

by:testn
ID: 9786685
how do you actually keep it in the database?
0
 
LVL 5

Author Comment

by:jjacksn
ID: 9787231
it is in XML.  
0
 
LVL 5

Author Comment

by:jjacksn
ID: 9787261
Let me try to clarify:

lets say this is what I want my XML database to be:

<ContactSet>
<Contact name="" job="">
          <PersonalInfo hobbie=""/>
          <MailingInformation address=""/>
</Contact>
<Contact>
.....
</ContactSet>

When I am trying to create a new row:
ContactSet.ContactRow cr = m_ContactSet.NewContactRow();
cr.name = "name";
cr.job = "job;
cr.PersonalInfo = XXX

what goes in XXX?  
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 5

Author Comment

by:jjacksn
ID: 9787322
And also, how do I access it?
0
 
LVL 4

Expert Comment

by:astankovic
ID: 9787584
I'm totally guessing here:
Shouldn't the PersonaInfo class have hobbie and address properties? Like in:

cr.PersonalInfo.hobbie = "value";
cr.PersonalInfo.address = "address string";

I would assume those should be created when you created typed dataset...

Alex
0
 
LVL 5

Author Comment

by:jjacksn
ID: 9789377
Alex, I don't think that is correct, but I'm not sure.

I have a method called GetPersonalInfoRows.  Are all child ComplexTypes treated as their own tables?  If so, I can i infer a relation to the parents, or do I need to explicity have one column/attribute match for the parent and child and then create a relation?
0
 
LVL 5

Author Comment

by:jjacksn
ID: 9789585
ok,I think I figured out how to access it, you just do stuff like

messageRow.GetComplextType1Rows()[0].GetSubComplexType2()[0].Name.  

Another quesiton, however:

If I am populating a listIVew, is it going to take up a lot of memery to have each item keep a reference to the messageRow it came from?  Or will this simply be a pointer into the DataTabe?
0
 
LVL 6

Expert Comment

by:zrh
ID: 9801384
It would actually be a pointer/reference to the Name property, ~4bytes,
ZRH
0
 
LVL 5

Author Comment

by:jjacksn
ID: 9806735
Please HELP!!! I still haven't figured out how to create the the new sub Rows (like the PersonalInfo row) and add them to the dataset when creating a new row.  
0
 
LVL 6

Expert Comment

by:zrh
ID: 9807447
If your using visual studio you can do it by providing an example xml document, then generating a schema (.xsd) then using that to generate a class inheriting from dataset to allow you easy access and typed data.  By the way you may want to look a the xsd.exe tool.  Or you can create another table in your dataset and create a relationship between them, (ie a table of personal information with an unique id such as the id of the account to who it is for as one column, then you set up a relation ship on those two tables with that column as the primary key, etc...)  If you have already done all that then there should be a YourDataSetInstance.AddPersonalInfoRow(...)... or something like that somewhere in your dataset.

ZRH
0
 
LVL 5

Author Comment

by:jjacksn
ID: 9807590
This is exactly what I have done.  However, I can't figure out how to create the actual row to use when I call MyDataSetInstance.AddPersonalInfoRow()... please advise.  Also, if I have an XML  node that has the correct xml format, can I load that into a row somehow?  
0
 
LVL 6

Expert Comment

by:zrh
ID: 9807972
There should be a method then something like MyDataSetInstance.PersonalInfoRows.NewPersonalInfoRow() that should return an instance of PersonalInfoRow that you can add, also to note is that your AddPersonalInfoRow method most likely is overloaded so that you can include the data in the method call, (ie. MyDataSetInstance.AddPersonalRow(string hobbies, etc...)).  Also, you may be able to use the ReadXml method from DataSet and have it read the fragment, then do a Merge(fragmentDataSet), never tried it but it's something to look at.

Hope that helps,
ZRH
0
 
LVL 5

Author Comment

by:jjacksn
ID: 9808051
ZRH,

I only have MyDataSetInstance.NewContactRow() (the outermost node schema).  I have a method ContactRow.PersonalInfoRows() but I can't seem to find anyway to create a new Personal Info row.  (In otherwords, my issue is that I don't know how to populate the Personal Info row in a new ContactRow that I create).
0
 
LVL 6

Accepted Solution

by:
zrh earned 2000 total points
ID: 9808118
The PersoanalInfoRow(s) are stored in a table, most likely called PersonalInfo of type PersonalInfoDataTable a reference to this table is at MyDataSetInstance.PersonalInfo[Rows].  This customized datatable should have a method called NewPersonalInfo[Row]() which returns an instance of PersonalInfo[Row].  You can then add this row to your PersonalInfoDataTable we got before.  Then set this instance of PersonalInfo[Row] 's parent to be your ContactRow you had mentioned before using the MyPersonalInfo[Row].SetParent(<yourContactRow>, MyDataSetInstance.Relations["<relationshipName"]).

PS: I haven't tested the above, but it should work.
PSS: The brackets around PersonalInfo[Row] are there because I don't know if the name is PersonalInfo, or PersonalInfoRow, you can customize this stuff with the schema before you generate the dataset.

ZRH
0

Featured Post

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
Suggested Courses

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question