views:

404

answers:

3

Hi,

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!

+1  A: 

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

kloucks
I'm afraid it's not this. FoxPro shows records marked as deleted, but doesn't show a few others. The ones I need. I can see them only when I run a build of my app or in OpenOffice Calc. Btw, OOffice cannot see the records flagged as deleted in FoxPro.
kfrej
As for as I can see - not being able to see the whole table in FoxPro - all the indices are unique. It might be the cause, but why would a compiled build show all the records without a problem? I think there is a problem somewhere between VS compile/debug and VS release build. Maybe some VS settings? The behaviour in VS environment is different from the behaviour outside of it.
kfrej
A: 

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.

A: 

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

Rick Schummer
I think it is possible. And it behaves like there was a different connection string (or DSN settings), but where would it be set? I did not change any default VS settings and I do not use the Dataset Designer - everything is done programmatically.
kfrej
Not really sure as I am not a Visual Studio developer yet. Wish I could be of more assistance.
Rick Schummer