expression in data column and Type GUID

  • Thread starter Thread starter Dirk W
  • Start date Start date
D

Dirk W

in my app I have two tables, which are connected with a datarelation.
Now I want to include a new datacolumn in the master table with an
expression that shows the number of rows in the detail table. My idea
was to simply count over the ID column of the detail table which is of
type GUID.

dsCard.Relations.Add("relLesson_LessonCard",
dsCard.Tables["Lesson"].Columns["ID"],
dsCard.Tables["LessonCard"].Columns["IDLession"]);

// Add a column to Lesson with the number of child rows
dsLCard.Tables["Lesson"].Columns.Add("NoCards", typeof(int),
"count(Child(relLesson_LessonCard).ID)");

I get a dataexception 'Invalid usage of aggregate function Count()
andf Type: GUID'.

Is there any possibility to count a column of type GUID (I don't have
any other column types in this table)? If not, how should I solve this
problem?

Thanks

Dirk
 
Anybody out there who has at least some ideas or comments to my post?

I also would appreciate if you had any work arounds for this issue.

Perhaps the solution I was aiming for with Count(Child...) was just
too ambitious and could be done easier by another way.

Dirk
 
Back
Top