Visual FoxPro and VS2008 do not show all DBF records. A separate build does
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!
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
I can say from experience that I've never seen the provider behave this way.
VFP can set "filters" that affect what you can see in sometimes non-obvious ways. They may be stored in the DBC - is it possible that the other application is setting filters?
Don't quite understand why the data would be different depending on where you run the app from though, which makes me think something else is going on.
If at all possible, I would recommend you get a copy of the VFP9 dev environment and open the DBC in that - that will give you a lot more to go on.
Is it possible the development environment is looking at a different set of data? Different connection string or DSN settings for the development environment?
Rick Schummer VFP MVP
精彩评论