做ARCGIS开发的时候,我一直用arcgis的方法来获取shp图层的属性,
上网找了一下,然后我决定用Microsoft Visual FoxPro的数据驱动试一下,貌似效果还不错
using System.Data;
using System.Data.OleDb;
using System.Collections;
DataTable dt = new DataTable();
System.Data.Odbc.OdbcConnection conn = new System.Data.Odbc.OdbcConnection();
string table = @"d:\shp1.dbf";
string connStr = @"Driver={Microsoft Visual FoxPro Driver};SourceType=DBF;SourceDB=" + table +";Exclusive=No;NULL=NO;Collate=Machine;BACKGROUNDFETCH=NO;DELETED=NO";
conn.ConnectionString = connStr;
conn.Open();
String sql = "select * from " + table;
OdbcDataAdapter da = new OdbcDataAdapter(sql, conn);
da.Fill(dTable);
本文介绍了一种利用Microsoft Visual FoxPro (VFP) 数据驱动直接读取Shapefile (shp) 中属性数据的方法。通过C#编程语言结合VFP驱动程序,可以有效地访问shp文件关联的dbf文件,并从中获取属性信息。

9748

被折叠的 条评论
为什么被折叠?



