jjacksn
asked on
URGENT:: Xml Data Sets
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_informa tion 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.
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_informa
The way contactRow is getting creating is by a call to the table that has contactRows.
how do you actually keep it in the database?
ASKER
it is in XML.
ASKER
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?
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?
ASKER
And also, how do I access it?
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
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
ASKER
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?
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?
ASKER
ok,I think I figured out how to access it, you just do stuff like
messageRow.GetComplextType 1Rows()[0] .GetSubCom plexType2( )[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?
messageRow.GetComplextType
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?
It would actually be a pointer/reference to the Name property, ~4bytes,
ZRH
ZRH
ASKER
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.
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.AddPer sonalInfoR ow(...)... or something like that somewhere in your dataset.
ZRH
ZRH
ASKER
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.AddPerso nalInfoRow ()... please advise. Also, if I have an XML node that has the correct xml format, can I load that into a row somehow?
There should be a method then something like MyDataSetInstance.Personal InfoRows.N ewPersonal InfoRow() 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.AddPerso nalRow(str ing 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
Hope that helps,
ZRH
ASKER
ZRH,
I only have MyDataSetInstance.NewConta ctRow() (the outermost node schema). I have a method ContactRow.PersonalInfoRow s() 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).
I only have MyDataSetInstance.NewConta
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.