Help with DataColumn.Expression

L

Lee Franke

Here ya go

Code that sets up the relationship
DataColumn parentCol;

DataColumn childCol;

parentCol = dsResults.Tables["People"].Columns["adminID"];

childCol = dsResults.Tables["Admins"].Columns["employeeID"];

DataRelation myRptRelation = new
DataRelation("AdminNames",parentCol,childCol,false);

dsResults.Relations.Add(myRptRelation);



Code that adds the column
//now add a NEW column that will populate the admin's name
DataColumn cName = new DataColumn();

cName.DataType = System.Type.GetType("System.String");

cName.ColumnName = "adminName";

cName.Expression = "Child.displayName" ;

dsResults.Tables["People"].Columns.Add(cName);

Thanks,

lee franke
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,527
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top