Home All Groups Group Topic Archive Search About

hierachical related data in datatset

Author
1 May 2006 7:59 AM
Jon Vaughan
I have a hierachical dataset brought back from a sql server stored procedure
with a design as follows :

StaffID
<Staff Columns>

AddressID
<Address Columns>
StaffID_FK

PhoneID
<Phone Columns>
AddressID_FK

Im using a disconnected architecture, so when I recieve the dataset , I
remap the the relationship (is there no way to get this relationship from
sql server - see's silly remapping). What im now looking to do is to
duplicate a staff members data , if I copied a row from the Staff table will
all the related data also be duplicated ? and if it wont whats the best way
to achieve this result ?

Jon

Author
1 May 2006 9:36 AM
Cor Ligthert [MVP]
Jon,

First of all if you use a newsreader as Outlook Express, do us than a favor
and don't multipost. Crossposting is appriciated in these dotnet newsgroup.
Sending one message to more newsgroups at once.

> Im using a disconnected architecture, so when I recieve the dataset , I
> remap the the relationship (is there no way to get this relationship from
> sql server - see's silly remapping). What im now looking to do is to
> duplicate a staff members data , if I copied a row from the Staff table
> will all the related data also be duplicated ? and if it wont whats the
> best way to achieve this result ?
>

It will not automaticly be duplicated, if there is a reference to it, is
completely dependend how that you made your relation and how you do that
copying.

I hope this helps,

Cor
Author
1 May 2006 10:39 AM
Jon Vaughan
Appologies for the mulitple post. I posted here and then found the ado group
after and posted there as it was more relavent.

About the relationship. I pull back the dataset over a webservice, as none
of the relational data comes I then re added it using :

dSet.Relations.Add("Rel1", dSet.Tables("Tbl1").Columns( .......

To replicate the relationship that was state in SQL Server.

In this situtauion what is the better method to replicate ?

Thanks

Jon


Show quoteHide quote
"Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message
news:es$8pJQbGHA.4248@TK2MSFTNGP05.phx.gbl...
> Jon,
>
> First of all if you use a newsreader as Outlook Express, do us than a
> favor and don't multipost. Crossposting is appriciated in these dotnet
> newsgroup. Sending one message to more newsgroups at once.
>
>> Im using a disconnected architecture, so when I recieve the dataset , I
>> remap the the relationship (is there no way to get this relationship from
>> sql server - see's silly remapping). What im now looking to do is to
>> duplicate a staff members data , if I copied a row from the Staff table
>> will all the related data also be duplicated ? and if it wont whats the
>> best way to achieve this result ?
>>
>
> It will not automaticly be duplicated, if there is a reference to it, is
> completely dependend how that you made your relation and how you do that
> copying.
>
> I hope this helps,
>
> Cor
>
Author
1 May 2006 12:38 PM
Cor Ligthert [MVP]
Jon,

I assume that the relationship is set on the webservice or do I see that
wrong, otherwise you should have to set it again of course.

I assume as well that the dataset is normal tranported using a VS created
webservice and not as a kind of file. Than I would add the schema
information to it.

Cor
Author
1 May 2006 3:33 PM
Jon Vaughan
You are right the relationship is set on the web services , but we are
digressing from the original point which is, whats the best way to duplicate
a row and its related records in a hierachical dataset ?


Show quoteHide quote
"Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message
news:u4ODuvRbGHA.612@TK2MSFTNGP03.phx.gbl...
> Jon,
>
> I assume that the relationship is set on the webservice or do I see that
> wrong, otherwise you should have to set it again of course.
>
> I assume as well that the dataset is normal tranported using a VS created
> webservice and not as a kind of file. Than I would add the schema
> information to it.
>
> Cor
>
Author
1 May 2006 3:51 PM
Cor Ligthert [MVP]
Jon,

I was starting my first message about the way you was duplicating. That word
can mean a lot.

Do you create a new member with a new key or are you importing the datarow
to a cloned dataset. This makes of course a lot of difference.

However, there will AFAIK never be an automatic copy of childrows then. A
second point is that a DataSet realation is forever a "one to more"
relation, so the reference cannot stay as well.

Cor
Author
1 May 2006 6:46 PM
Jon Vaughan
Cor,

The process is :

interface calls web service
web service returns a dataset
this dataset doesnt contain any relational data , so its added using :
dSet.Relations.Add("Rel1", dSet.Tables("Tbl1").Columns( .......
Now all I was wanting to do was , copy the root item and have all the one to
many sides cascade copy over as well.

Hope this is the information you were looking for ?

J


Show quoteHide quote
"Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message
news:Ou9MNbTbGHA.1200@TK2MSFTNGP03.phx.gbl...
> Jon,
>
> I was starting my first message about the way you was duplicating. That
> word can mean a lot.
>
> Do you create a new member with a new key or are you importing the datarow
> to a cloned dataset. This makes of course a lot of difference.
>
> However, there will AFAIK never be an automatic copy of childrows then. A
> second point is that a DataSet realation is forever a "one to more"
> relation, so the reference cannot stay as well.
>
> Cor
>
Author
1 May 2006 8:38 PM
Cor Ligthert [MVP]
Jon,

There are two methods, for 1.x you can in my opinon only use the GetChilds
from the parent relation.

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

In 2.0 you can ignore the relation. Set the key from the relation in the
datarow filter and than use the new method ToTable.

http://msdn2.microsoft.com/en-us/library/a8ycds2f.aspx

As you probably already understand do I prefer the last one.

I hope this helps,

Cor

Show quoteHide quote
"Jon Vaughan" <jonnyvaug***@hotmail.com> schreef in bericht
news:BIs5g.255132$117.61273@fe02.news.easynews.com...
> Cor,
>
> The process is :
>
> interface calls web service
> web service returns a dataset
> this dataset doesnt contain any relational data , so its added using :
> dSet.Relations.Add("Rel1", dSet.Tables("Tbl1").Columns( .......
> Now all I was wanting to do was , copy the root item and have all the one
> to many sides cascade copy over as well.
>
> Hope this is the information you were looking for ?
>
> J
>
>
> "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message
> news:Ou9MNbTbGHA.1200@TK2MSFTNGP03.phx.gbl...
>> Jon,
>>
>> I was starting my first message about the way you was duplicating. That
>> word can mean a lot.
>>
>> Do you create a new member with a new key or are you importing the
>> datarow to a cloned dataset. This makes of course a lot of difference.
>>
>> However, there will AFAIK never be an automatic copy of childrows then. A
>> second point is that a DataSet realation is forever a "one to more"
>> relation, so the reference cannot stay as well.
>>
>> Cor
>>
>
>
Author
1 May 2006 10:44 PM
Jon Vaughan
Thanks loads cor , I will have a play aroudn and see which suits me better ,
starting with 2.0 first :)

Show quoteHide quote
"Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message
news:u9i7y7VbGHA.1276@TK2MSFTNGP03.phx.gbl...
> Jon,
>
> There are two methods, for 1.x you can in my opinon only use the GetChilds
> from the parent relation.
>
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdatadatarowclassgetchildrowstopic.asp
>
> In 2.0 you can ignore the relation. Set the key from the relation in the
> datarow filter and than use the new method ToTable.
>
> http://msdn2.microsoft.com/en-us/library/a8ycds2f.aspx
>
> As you probably already understand do I prefer the last one.
>
> I hope this helps,
>
> Cor
>
> "Jon Vaughan" <jonnyvaug***@hotmail.com> schreef in bericht
> news:BIs5g.255132$117.61273@fe02.news.easynews.com...
>> Cor,
>>
>> The process is :
>>
>> interface calls web service
>> web service returns a dataset
>> this dataset doesnt contain any relational data , so its added using :
>> dSet.Relations.Add("Rel1", dSet.Tables("Tbl1").Columns( .......
>> Now all I was wanting to do was , copy the root item and have all the one
>> to many sides cascade copy over as well.
>>
>> Hope this is the information you were looking for ?
>>
>> J
>>
>>
>> "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message
>> news:Ou9MNbTbGHA.1200@TK2MSFTNGP03.phx.gbl...
>>> Jon,
>>>
>>> I was starting my first message about the way you was duplicating. That
>>> word can mean a lot.
>>>
>>> Do you create a new member with a new key or are you importing the
>>> datarow to a cloned dataset. This makes of course a lot of difference.
>>>
>>> However, there will AFAIK never be an automatic copy of childrows then.
>>> A second point is that a DataSet realation is forever a "one to more"
>>> relation, so the reference cannot stay as well.
>>>
>>> Cor
>>>
>>
>>
>
>