Visual Studio .NET - unrecognized database format *.accdb

Asked By Kartik Goyal on 30-Dec-11 08:57 AM
I bought a new Laptop HP Pavilion G4-1201TU. I got Window 7 Basic pre installed. I format the system and installed Window 7 64Bit.

Now I am trying to run my existing .NET project and getting below error. I confirm that this particular code is running on my other system, but not on this new Laptop.

ERROR 
System.Data.OleDb.OleDbException was unhandled
  ErrorCode=-2147467259
  Message="Unrecognized database format 'D:\DotNet\PayRoll\PayRoll\bin\Debug\DB\payroll-db.accdb'."
  Source="Microsoft JET Database Engine"
  StackTrace:
       at System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection)
       at System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
       at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup)
       at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
       at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
       at System.Data.OleDb.OleDbConnection.Open()
       at System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection, ConnectionState& originalState)
       at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
       at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
       at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)
       at PayRoll.clsRecordset.Open(String SqlQuery) in D:\DotNet\PayRoll\PayRoll\clsRecordset.vb:line 16
       at PayRoll.common.GetAppSetting() in D:\DotNet\PayRoll\PayRoll\common.vb:line 54
       at PayRoll.common.SetConnection() in D:\DotNet\PayRoll\PayRoll\common.vb:line 48
       at PayRoll.MDI.MDI_Load(Object sender, EventArgs e) in D:\DotNet\PayRoll\PayRoll\MDI.vb:line 28
       at System.EventHandler.Invoke(Object sender, EventArgs e)
       at System.Windows.Forms.Form.OnLoad(EventArgs e)
       at System.Windows.Forms.Form.OnCreateControl()
       at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
       at System.Windows.Forms.Control.CreateControl()
       at System.Windows.Forms.Control.WmShowWindow(Message& m)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
       at System.Windows.Forms.ContainerControl.WndProc(Message& m)
       at System.Windows.Forms.Form.WmShowWindow(Message& m)
       at System.Windows.Forms.Form.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.SafeNativeMethods.ShowWindow(HandleRef hWnd, Int32 nCmdShow)
       at System.Windows.Forms.Control.SetVisibleCore(Boolean value)
       at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
       at System.Windows.Forms.Control.set_Visible(Boolean value)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.Run(ApplicationContext context)
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
       at PayRoll.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
       at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 


Please help me
Suchit shah replied to Kartik Goyal on 30-Dec-11 09:06 AM
This error indicates that the Microsoft Access database  has become corrupted. 

If you have access to a copy of Microsoft Access, you can try to open and repair the adTempus database file (named in the error message cited above). If the repair process succeeds.
Vishwanath Reddy replied to Kartik Goyal on 30-Dec-11 09:24 AM
Hi

*.accdb is MS-Access 2007 format, if you want to connect this DB using .Net,
use this provider

"Provider=Microsoft.ACE.OLEDB.12.0; Data Source=DATABASEFILE.ACCDB

I hope this will help you.

Regards,
Vishwanath
Devil Scorpio replied to Kartik Goyal on 30-Dec-11 05:29 PM
HI,

The solution for unrecognized database format *.accdb is just replace provider attribute’s value of the connection string like this
Provider=Microsoft.ACE.OLEDB.12.0

Old value was
Provider=Microsoft.Jet.OLEDB.4.0

New Value is
Provider=Microsoft.ACE.OLEDB.12.0
Kartik Goyal replied to Vishwanath Reddy on 30-Dec-11 10:28 PM
I agree with you, as I mentioned that the same code it working on my other system..there I am using 
"Provider=Microsoft.ACE.OLEDB.12.0; Data Source=DATABASEFILE.ACCDB 

But when this provided did not work on my Laptop then I changed it from ACE to JET

Later I re-installed my System with 32Bit and now it's working fine..on this 32Bit Microsoft.ACE.OLEDB.12.0  is working.

So I got a new question here.
Is there different setup's available for 32bit and 64bit Windows ? and If no then why the same setup did not work with 64Bit windows