title: Selecting distinct records from DataTable
body: <p>I've checked this question <a href="https://stackoverflow.com/questions/1199176/how-to-select-distinct-values-from-datatable">here</a> as well as a number of other links all proposing similar solutions, but when I go <code>distinctTable = dt.DefaultView.ToTable(true, "FILENAME");</code> I get an error message saying: </p>
  
  <blockquote>
    <p>A field or property with the name 'LOCATION' was not found on the
    selected data source.</p>
  </blockquote>
  
  <p>Now, I have four columns altogether: Location, Folder, Filename, and Status. The values for Folder and Filename I select from the database, but the values for location and status are determined thru C# code. I have no idea why it's saying that the Location column isn't found because it works fine when I omit the above line.</p>
  
  <p>I don't think I can use SQL because some of the records are being generated by user input (i.e. they aren't coming from the database).</p>
  
  <p>I've also tried </p>
  
  <pre><code>view = new DataView(dt); 
  distinctTable = view.ToTable(true, "LOCATION", "FOLDER", "FILENAME", "STATUS");
  </code></pre>
  
  <p>or just <code>distinctTable = view.ToTable(true, "FILENAME");</code> for the latter statement but this doesn't seem to do anything - it doesn't throw an exception but it doesn't eliminate duplicate records either.</p>
  
  <p>What am I doing wrong?</p>