Click here to Skip to main content
12,550,449 members (45,311 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# Windows OleDb
I'm working on a system that reads Shapefiles (ESRI ShapeFile "*.Shp"), and I'm having problems with the data file ".Dbf", in some cases i can open it without problems. But in other cases i can't read the records.

Here is the code to read the File:

OleDbConnection connection = new OleDbConnection( "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Path.GetDirectoryName( fileName ) + ";Extended Properties=DBASE III" );
                connection.Open( );
                OleDbDataAdapter adapter = new OleDbDataAdapter( "select * from " + Path.GetFileName( fileName ), connection );
                DataSet dataSet = new DataSet( ); ;
                adapter.Fill( dataSet );
                if ( dataSet.Tables.Count > 0 ) {
                    data = dataSet.Tables[ 0 ];

And Here is the Error Message:

System.Data.OleDb.OleDbException: nexpected error caused by drivers from external database (8961).

Can anyone help me?
Posted 16-Nov-12 2:58am
digimanus 16-Nov-12 8:59am
you can open a DBF file in Excel. An Excel file can be easily imported in Sql Server

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

this may help you about error.-[^]
gilvani 16-Nov-12 10:14am
This article did not help me
Abhishek Pant 16-Nov-12 10:20am
I told you about whats is the cause of that error.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.161021.1 | Last Updated 16 Nov 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100