Im coonecting to access database using the below connection string :
string strConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\Users\\Sally\\Documents\\Visual Studio 2010\\Projects\\StudentsApplication\\St开发者_如何学编程udentsApplication\\School\\School.accdb";
but it's giving me an error Unrecognized database format. is the connection string wrong?
Try with this ,
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\mydatabase.mdb;Jet OLEDB:System Database=system.mdw;User ID=myUsername;Password=myPassword;
You should probably add "" around the path:
string strConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\"C:\\Users\\Sally\\Documents\\Visual Studio 2010\\Projects\\StudentsApplication\\StudentsApplication\\School\\School.accdb\"";
Take a look a this site, it has examples for all kinds of databases connection strings:
Connection String Home Page
The reason would be that the ACE provider for Microsoft Access is not installed.
Does your system has Office 2007? Its installed normally with Office 2007.
If no, please install and download Office 2007 Data Connectivity Components
Read this: http://social.msdn.microsoft.com/forums/en-US/Vsexpressvb/thread/2a658b68-49c9-448e-8aca-778c1573ffaa/
精彩评论