Click here to Skip to main content
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 3:58am
gilvani2.5K
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 Sergey Alexandrovich Kryukov 279
1 OriginalGriff 190
2 DamithSL 185
3 Peter Leow 105
4 Kornfeld Eliyahu Peter 105
0 OriginalGriff 7,355
1 DamithSL 5,254
2 Sergey Alexandrovich Kryukov 4,942
3 Maciej Los 4,906
4 Kornfeld Eliyahu Peter 4,514


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