TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Virgil Bevans
NA
16
6.7k
Testing for empty table after retrieving "distinct"
Oct 19 2013 11:46 AM
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.
Reply
Answers (
2
)
How to login in a server by giving Credentials?
binding data to gridview