data table from typed view

Posts   
 
    
e106199
User
Posts: 175
Joined: 09-Sep-2006
# Posted on: 26-May-2010 19:54:20   

Hi, i have a typed view that returns the list of all active students with about 10 fields. using this typed view, i would like to create a data table and add 1 more field to it. this new field will hold the status of the student which is not returned by the view.

any suggestions what would be the best way to accomplish this?

it will be like: use all fields from the typed view add new field and set its value for each record view returns.

thank you -shane

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 27-May-2010 04:40:29   

As a matter of fact a TypedView is a DataTable. This is an approximate code:

DataTable nwDataTable =  myFetchedTypedView.DefaultView.ToTable();
nwDataTable.Columns.Add("Status");
foreach (DataRow r in nwDataTable.Rows)
{
      r["Status"] = something...;               
}
David Elizondo | LLBLGen Support Team
e106199
User
Posts: 175
Joined: 09-Sep-2006
# Posted on: 27-May-2010 07:50:50   

daelmo wrote:

As a matter of fact a TypedView is a DataTable. This is an approximate code:

DataTable nwDataTable =  myFetchedTypedView.DefaultView.ToTable();
nwDataTable.Columns.Add("Status");
foreach (DataRow r in nwDataTable.Rows)
{
      r["Status"] = something...;               
}

thank you that will work