• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1157
  • Last Modified:

Need to know easiest way to save data that has been changed in a datagridview in C# back to a local foxpro dbf file

Would like to know the proper method for attaching to LOCAL  tables (dbf files), and using datagrids and textboxes and editboxes etc... to edit the data then how to update this back to the local table.

Thanks a Ton!!

1 Solution
Olaf DoschkeSoftware DeveloperCommented:
C# would need to use the foxpro odbc driver or better yet for support of VFP7+ DBFs: the Foxpro Oledb provider.

Download it here http://www.microsoft.com/en-us/download/details.aspx?id=14839 and install it first.

With that you can use any c# way of loading, modifying and saving data as with any other oledb data source.

For example an OleDbDataAdapter in conjunction with an OleDbCommandBuilder will read and update data from any oledb source, also DBFs, like this:


Follow instructions nd change the connection string to something like
@"Provider=vfpoledb.1;Data Source=...;Collating Sequence=machine"

Where "..." can be either a fullpath to a DBC file or a path to a directory of free DBFs.

You need a primary key field in the dbf for the OleDBCommandBuilder to be able to create Update-SQL or Insert-SQL statements, though. In case of a free dbf a candidate key is sufficient.

Bye, Olaf.
busycoderAuthor Commented:
Just what I needed to get going with this, thanks again Olaf!!

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now