3
Answers

Query not returning results

Ask a question
Program creates/adds to data table of songs from specified folder(s), obtaining initial data by parsing the file names.  User can search any time for new entries, so program needs to check to see if song is already in the data file.  Wrote the following linq query to check for this condition, but it never returns results.  Can someone explain my folly?

//search for duplicate record and loop if found
var result =
from kSong in DtSongs.AsEnumerable()
where kSong["DiskID"].ToString() == song[3] && kSong["Title"].ToString() == song[1] && kSong["Artist"].ToString() == kSong[2]
select kSong;

foreach (var r in result)
{
count++;
}


Answers (3)