This project is read-only.

How to use linq to fill combobox with dbftable

Feb 14, 2010 at 11:03 PM

I've posted this question on CodeProject as well:

I have a large dbf file with over 350.000 records. The data has address info, so postcode, street and house number.
I first read the complete file using ADO (takes 30s) and then I fill the first combobox with distinct postcodes using linq and the second one with distinct street names in the selected postcode and the third one with the distinct house numbers of the selected street.
This is working fine except for the slow start.

I'm trying to do the same with DbfDotNet. The reading of the file and showing it in the dbfTableView only takes a second or two! That's <strike>great</strike> fantastic.

But how do I fill the combobox with the same values as before?

This is my old query:

var distinctPostalCodes = (from row in this.fileContent.AsEnumerable()
                           select new
                               code = row.Field<string>(columnNameCode),
                               name = row.Field<string>(columnNameName)
                           }).OrderBy(x => x.code).Distinct();

Any help would be much appreciated.