Why don't my datarelations work??!?!?!!??

  • Thread starter Thread starter Rick Palmer
  • Start date Start date
R

Rick Palmer

OK, check out this XML representations of my Dataset schema:

<PIAccounting>
<Transmittal>
<Transaction>
<PolicyInfo>
<PAInfo>
<Payments>
<ErrorInfo>
</PIAccounting>



When my program begins, the schema looks like this:

<PIAccounting>
<Transmittal>
<Transaction>
<PolicyInfo>
<PAInfo>
<Payments>
</PIAccounting>
....notice there is no ErrorInfo table...


I'm adding the ErrorInfo table later, but it's not adding like I want...
Here's what I am intending the final schema to look like:

<PIAccounting>
<Transmittal>
<Transaction>
<PolicyInfo>
<PAInfo>
<Payments>
<ErrorInfo>
</PIAccounting>

The "ErrorInfo" table is intended to be a child table of the "Transaction"
table.
Both tables are related by a field called "TransactionNo".


Here's What I'm doing:

I add the new "ErrorInfo" table to the dataset.
I add columns to the "ErrorInfo" table (one of which is the "TransactionNo"
field")
I add a new datarelation as follows:

ds.relations.add("Transaction_ErrorInfo",
ds.tables("Transaction").columns("TransactionNo"),
ds.tables("ErrorInfo").columns("TransactionNo")

That really looks like it sets up a parent-child relationship between the
two tables, but it doesn't. It doesn't do CRAP! It doesn't even generate
an error! It just stuffs the ErrorInfo table at the root level, which is
NOT what I want. What am I doing wrong here??????


-rp
 
Rick:

What related records are in the child table? Typically, it will write the
parent table first, then at the end of the First roots last element, it
will write the second table, third etc where the relations exists.

Here's a copy of a dummy record in my employees table that Has relations
defined. Now, if I'll get the same definition for a similar record with
someone who has no vacation defined. At the bottom of the file, I'll end up
with my other elements for leave and other tables which match back on
employee ID. However, there are many ways to layout your data in XML, how
are you writing it out?

<Employees diffgr:id="Employees203" msdata:rowOrder="202">
<Address>516 Palm Dr.</Address>
<BirthDate>xxxx-03-xxT00:00:00.0000000-05:00</BirthDate>
<City>Aiken</City>
<DateHired>2002-11-11T00:00:00.0000000-05:00</DateHired>
<Dept />
<Emergency_Contact_Num>xxx-xx-xxxx</Emergency_Contact_Num>
<Emergency_Contact>Lxxx Yxxxx</Emergency_Contact>
<EmplNum>246</EmplNum>
<Ext>0</Ext>
<FirstName>Xxxxxx</FirstName>
<HomePhone>(xxx)-xxx-xxxx</HomePhone>
<LastName>Yxxxxx</LastName>
<Location>Axxxxx</Location>
<SSN>xx0-xx-6xxx</SSN>
<State>SC</State>
<Supervisor />
<Title>Transcriptionist</Title>
<VacTaken>0</VacTaken>
<Veteran>NO</Veteran>
<Zip_Code>29803</Zip_Code>
<Review_Date>2003-11-11T00:00:00.0000000-05:00</Review_Date>
<Termination_Date>2001-01-xxT00:00:00.0000000-05:00</Termination_Date>
<Log_In>xxxxx</Log_In>
<Leave_Accrued>xxxxx</Leave_Accrued>
<Emp_Type>Full Time</Emp_Type>
<Exempt>false</Exempt>
<PersonInfo>246 Xxxxxx, xxxxx</PersonInfo>
</Employees>
 
Set the DataRelation.Nested property to true and DataSet.WriteXML() method
generates your relationsships nested and not separated.

Jeroen
 
Back
Top