One of the project notes: DBF database read

Source: Internet
Author: User

Because the site of the database is still Visual FoxPro, and its own programming language is C #, can not directly access, in the online search a lot of information, finally finally found a solution in DRL, DBF database Read the problem is basically solved. Here are some notes on the process of solving this problem

1. When using "provider=microsoft.jet.oledb.12.0;", the following error is indicated:

An unhandled exception of type ' System.InvalidOperationException ' occurred in System.Data.dll

Additional information: "microsoft.jet.oledb.12.0" Provider is not registered on the local computer.

When you use "provider=microsoft.ace.oledb.12.0;", you are prompted with the following error:

An unhandled exception of type ' System.Data.OleDb.OleDbException ' occurred in System.Data.dll

Additional Information: The installable ISAM could not be found.

2. Then according to DRL replies, using the following statement (provider=vfpoledb.1), you can normally import.

Code Source: http://stackoverflow.com/questions/22361457/c-sharp-read-from-dbf-files-into-a-datatable

1 varYourresultset =NewDataTable ();2 3 varYourconnectionhandler =NewOleDbConnection (@"Provider=vfpoledb.1;data source=c:\");4 5 Yourconnectionhandler.open ();6 7 if(yourconnectionhandler.state! = ConnectionState.Open)return;8 Const stringMYSQL ="Select jh,rcyl from dba04 Where JH like ' 7p10% '";//JH like ' 7p10% ' indicates that the JH field contains ' 7p10 ', while the percent semicolon is the meaning of the fuzzy query9 Ten varMyquery =NewOleDbCommand (MYSQL, yourconnectionhandler); One varDa =NewOleDbDataAdapter (myquery); A  - da. Fill (yourresultset); -  theYourconnectionhandler.close ();

After testing, "Visual FoxPro" and "foxbase+/dbase III Plus, no notes" of the two formats of the database, can be used in the above statement normal import, great!

3. In Debug mode, any CPU and x86 can be imported normally, and in Release mode any CPU will not be imported properly, it needs to be changed to x86. Because to consider the application of SQLite in the XP machine, so the study of the x86 problem, fortunately, tested a bit, sure enough to find the problem.

4. After uninstalling Visual FoxPro in the XP virtual machine, run the program and then prompt "Thevfpoledb.1 provideris not registered on the local machine." The problem disappears after reinstalling Visual FoxPro again.

Solution: The software was last provided with the installation program of Visual FoxPro, simple and rude.

One of the project notes: DBF database read

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.