473,395 Members | 1,558 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

datarelation

Hi Group,

I've got a datatable in a dataset. The Table has this schema; ID = id of
the record, RootID = id to which this record belongs to.

for example:

if I have 6 records, and rootID of records 1-5 is equal to 0, then the
parent of these records has the ID of 0;

I am trying to create a Relation between these two fields so when I bind
this data to a grid, it will display the hierarchy. I've been playing with
this for a while and cant get it right. Can somebody Please post a sample
on creating a simple relation inside the same datable.

Thanks in advance.

Marco
Nov 15 '05 #1
1 1327
try the following, hope can help
DataRelation RootChildRel = dataset.Relations.Add("RootChild",
dataset.Tables["yourtable"].Columns["ID"],
dataset.Tables["yourtable"].Columns["RootID"]);

Pei
"Marco Martin" <ma**********@sympatico.ca> wrote in message
news:TL*********************@news20.bellglobal.com ...
Hi Group,

I've got a datatable in a dataset. The Table has this schema; ID = id of
the record, RootID = id to which this record belongs to.

for example:

if I have 6 records, and rootID of records 1-5 is equal to 0, then the
parent of these records has the ID of 0;

I am trying to create a Relation between these two fields so when I bind
this data to a grid, it will display the hierarchy. I've been playing with this for a while and cant get it right. Can somebody Please post a sample
on creating a simple relation inside the same datable.

Thanks in advance.

Marco

Nov 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: serge calderara | last post by:
Dear all, I have a dataset which contains 2 DataTable The idea is to bind a text box control with one table field and then diaplaye the associated content of the second table based on the first...
1
by: yaser | last post by:
Hello: I need save my update but i can't :confused: :confused: :confused: look my code : Imports System.Data Imports System.Data.OleDb Public Class Form1
0
by: Stefan | last post by:
I need help with the following problem. I created a datarelation DataRelation oRelation = new DataRelation("plz_relation",odsAdressenDS.v_plz.plz_idColumn,...
0
by: Fox | last post by:
Is it possible to get back the DataRelation contect from a dataSet? { DataRelation myDataRelation; DataColumn parentColumn; DataColumn childColumn; parentColumn = myDataSet.Tables.Columns;...
1
by: Johann Blake | last post by:
I have a dataset that contains a parent table and a child table. A DataRelation exists between the two. I was under the impression from reading the VS docs that when I filled the parent table, the...
0
by: mazda_88 | last post by:
I have a number of tables inside a dataset. I have a repeater that I need to bind to. The data that is needed resides in two tables in the dataset. Here is the code that I'm using: Dim...
0
by: frank | last post by:
I have several tables that have a one to one relationship. I have DataRelation objects to define these relationships. I would like to bind the DataRelation to both a gridview and a formview so...
2
by: Rich | last post by:
Hello, Following an example at http://www.vb-tips.com/dbpages.aspx?IA=DG (by Cor Lightert and Ken Tucker) on binding a dataRelation to a Datagridview for sqlClient, I was able to view rows...
6
by: Aryan | last post by:
Hi, I want to use DataRelation object for setting up relationship between two different datatable, but i want to use multiple columns to set up relation between two tables. For example. ...
2
by: Tony Johansson | last post by:
Hello! I can't understand what is this table DataRelation used for. I mean as long as you have this DataTable I can't see any point in using this DataRelation. //Tony
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.