R – Visual FoxPro and VS2008 do not show all DBF records. A separate build does

dbfoledbvb.netvisual-foxprovisual-studio-2008

I am working on a project in Visual Studio 2008 (in vb.net). The app needs to import data from a Visual FoxPro database (dbc file). Do not ask why FoxPro. It needs to be vfp and the database is updated daily by another application; therefore, I cannot use any other database format.

I connect to the database through OleDb FoxPro driver (the latest version). Everything is ok (apart from the speed). I can import data from all the tables I need (dbf files). I load it into a dataset and then operate on the dataset itself not to loose time on reconnecting (I just need to read data at this stage).

The problem is:
Not all records are being shown when I compile and run the code.

However, when I run a compiled version from the Release folder (in the bin directory), the app displays more records.

What is more puzzling, when I open the same datatable file in Visual FoxPro 9.0, I can see only the data that is being shown in VS2008 (not in the Realease version).
However, if I open the dbf in OpenOffice Calc, it shows all the records – that is, the same records as the Release version of my app.

My first thought was: if it does not show everything in VFP 9, the files must have been created in a different version of VFP, so I should change my connection string. However, why would the compiled Release version show all the correct data? The connection string must be ok.

I downloaded DBF Viewer Plus to have a look at my dbfs in another app but it cannot see all the records either.

I have no idea why it behaves this way. And it is rather annoying, because I need to make a build of my app every single time I want to test it.

I'm developing on Windows Vista.

Thank you for all your help!

Best Answer

Haven't worked with foxpro for a few years but it used to be a "feature" of dbf files that when you delete a record it doesn't actually disappear until you "pack" the file. It simply sets a flag that indicates the record is deleted and most foxpro views of the file filter it out accordingly, but its still there and visible to oledb connections.

edit: another possibility is the the Index you are using - if it specifies "unique" it will filter out all but one of the "duplicate" records in a particular view

Related Topic