使用.IDX文件中的DBF文件搜索文件、IDX、DBF

2023-09-11 07:18:39 作者:有些人只能埋藏于心

我有一个DBF文件,一个索引文件。 我想读索引文件和搜索记录满足一定的条件。 (例如:搜索记录它的StudentName以A使用Student.DBF和StudentName.idx)

I have a DBF file and a index file. I want to read index file and search records satisfy some condition. (for example: search records which its StudentName begin with "A" by using Student.DBF and StudentName.idx)

我如何做到这一点编程?

How do I do this programmatically?

推荐答案

我没有在code从我的头顶,但如果你不希望使用ODBC,那么你应该看看阅读ESRI形状文件,它们是由3部分(或以上)一个.dbf(你在找什么),PRJ文件和.SHP文件。这可能需要一些工作,但你应该能够挖掘出code。你应该看看 SharpMap的在codePLEX。这不是一个简单的任务来读取DBF W / O ODBC,但它可以做到的,而且有很多的code在那里这样做。你必须处理大端VS小尾数价值观,以及一系列文件版本也是如此。

I dont have the code off the top of my head, but if you do not want to use ODBC, then you should look into reading ESRI shape files, they consist of 3 parts (or more) a .DBF (what you are looking for), a PRJ file and a .SHP file. It could take some work, but you should be able to dig out the code. You should take a look at Sharpmap on codeplex. It's not a simple task to read a dbf w/o ODBC but it can be done, and there is a lot of code out there for doing this. You have to deal with big-endian vs little-endian values, and a range of file versions as well.

如果你去这里你会发现code读取DBF文件。具体地讲,你会感兴趣的公共无效ReadAttributes(流流)方法。

if you go here you will find code to read a dbf file. specifically, you would be interested in the public void ReadAttributes( Stream stream ) method.