Click here to Skip to main content
11,705,762 members (53,188 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# Windows OleDb
Hi!
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
gilvani3.1K
Comments
digimanus at 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
good
Please Sign up or sign in to vote.

Solution 1

this may help you about error.-
http://support.microsoft.com/kb/321003[^]
  Permalink  
Comments
gilvani at 16-Nov-12 10:14am
   
This article did not help me
Abhishek Pant at 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
0 OriginalGriff 213
1 Sergey Alexandrovich Kryukov 170
2 Inimicos 60
3 ProgramFOX 50
4 Richard MacCutchan 45
0 OriginalGriff 9,053
1 Sergey Alexandrovich Kryukov 8,347
2 CPallini 5,189
3 Maciej Los 4,726
4 Mika Wendelius 3,626


Advertise | Privacy | Mobile
Web04 | 2.8.150819.1 | Last Updated 16 Nov 2012
Copyright © CodeProject, 1999-2015
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