Click here to Skip to main content
15,850,446 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
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
Comments
Herman<T>.Instance 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

this may help you about error.-
http://support.microsoft.com/kb/321003[^]
 
Share this answer
 
Comments
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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900