Testing for empty table after retrieving "distinct"
I have a table of songs that can be added to and printed either in whole or in part. The Windows form where the user selects criteria for the report contains a combobox that should contain a list of the dates when reports were printed. The table has a field called "DatePrinted" that is updated anytime that particular record is printed. This is the code I use to develop the list for the combo:
// orders records in ascending date
DataView tempView =
new DataView(Dt, "", "DatePrinted ASC",DataViewRowState.CurrentRows);
//returns rows with distinct values
DataTable DistinctDates = tempView.ToTable("distinctDates", true, "DatePrinted");
Before binding the resulting table to the combobox I want to check to see if there are truly any records returned. Here's where the problem appears. I've tried the following:
if (DistinctDates.DefaultView.Count() == 0)
This always returns "false" and checking with the debugger shows that the table contains a single record which is empty. I've tried various ways of testing for an empty record, but the proper method eludes me.