C # (. NET) operations on DBF (ArcGIS SHP Attribute Table) (verified Version)

Source: Internet
Author: User

I used to find some materials and wrote an article

C # (. NET) operations on DBF (ArcGIS SHP Attribute Table)

URL: http://www.cnblogs.com/xiexiaokui/archive/2007/11/12/956984.html

However, none of the above methods succeeded, and I didn't know where the problem was.

Therefore, the previous statistics were performed using feature in ArcGIS, but the statistics on attribute data were too wasteful.

So in the afternoon, I began to look for information on direct operations on the DBF DATABASE. After testing, none of the methods on the Internet were available.

There are three technical routes:

1. Install FoxPro, or DBF driver, and use special DBF interfaces.

2. Data Conversion DBF-> Excel (*. xls)-> access

For the first two types of data, it is of course the last resort. It would be better if ado.net directly operates DBF data.

So I thought of using the system to generate a database connection string. I didn't need to hand-write it and finally the test was successful.CodeAs follows?

 

Code
Odbcconnection OCN =   New Odbcconnection ( " DSN = DBASE files " );
String Select =   " Select * from "   + Textbox1.text;
Odbcdataadapter ODA =   New Odbcdataadapter (select, OCN );
Datatable ODS =   New Datatable ();
ODA. Fill (ODS );
Datagridview1.datasource = ODS;

Textbox1.text is a full path with a path and extension.

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.