TypedList DataSet throwing an exception

Posts   
 
    
Gareth
User
Posts: 24
Joined: 09-Apr-2004
# Posted on: 27-Apr-2004 00:41:00   

Hi Frans,

Looking through the available item in the TpedList I came across the the DataSet. I know that the TypedList returns as a DataTable.

But when I use:

 pageTree.DataSet.Relations.Add("NodeRelation", pageTree.DataSet.Tables[0].Columns["PageID"], pageTree.DataSet.Tables[0].Columns["ParentPageID"]);

I get - Object reference not set to an instance of an object.

Any ideas?

UPDATED: I have been doing this:

          DataSet ds = new DataSet();
         ds.Tables.Add(pageTree);
         ds.Relations.Add("NodeRelation", ds.Tables[0].Columns["PageID"], ds.Tables[0].Columns["ParentPageID"]);

Which works fine.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 27-Apr-2004 09:02:42   

You first have to add the typed list to the dataset, then add the relation object

Frans Bouma | Lead developer LLBLGen Pro
Gareth
User
Posts: 24
Joined: 09-Apr-2004
# Posted on: 27-Apr-2004 22:39:47   

Not the above then? I have another a look at this simple_smile Thanks.