The database file may be corrupted. Run the repair utility to check the database file. [ Database name = C:\Users\Administrator\Documents\My Web Sites\Business-ZPSCMS\ZPSCMS.accdb ]
Description:
An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlServerCe.SqlCeException: The database file may be corrupted. Run the repair utility to check the database file. [ Database name = C:\Users\Administrator\Documents\My Web Sites\Business-ZPSCMS\ZPSCMS.accdb ]
Source Error:
Line 8: var db = Database.OpenConnectionString(connectionString);
Line 9: var selectQueryString = "SELECT TypeName FROM TypeList";
Line 10: var selectedData = db.Query(selectQueryString); Line 11:
Line 12: }
My code is as below :
var connectionString = "Data Source=" + Server.MapPath("/") + "ZPSCMS.accdb;";
var providerName = "Microsoft.Jet.OLEDB.4.0";
var db = Database.OpenConnectionString(connectionString);
var selectQueryString = "SELECT TypeName FROM TypeList";
var selectedData = db.Query(selectQueryString);
I don't understand why the error come out and how to fix it. May I know if any one can answer this error ?
After searching some documents, this issue may occur due to corrupted Vaio Messenger components and we need to uninstall Vaio Messenger. Please refer to the following links:
The problem is that while you have a variable for the ADO.NET provider, you have not specified the provider in the OpenConnectionString method call, so WebMatrix.Data.Database falls back on the SqlServerCe provider (which is what is throwing the exception).
Also, you have an accdb file, which must be connected via the ACE OleDb provider. You have set your providerName variable to point to the Jet provider, which will only work with Access mdb files. Either change the variable declaration as follows:
var providerName = "Microsoft.ACE.OleDb.12.0";
or save the file as an mdb file if you have not installed the ACE provider on the server. In either case, pass hte resulting variable ot the OpenConnectionString method:
var db = Database.OpenConnectionString(connectionString, providerName);
After I installed AccessDatabaseEngine_2010_x64, the error is changed as below.
Unable to find the requested .Net Framework Data Provider. It may not be installed.
Description:
An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: Unable to find the requested .Net Framework Data Provider. It may not be installed.
Source Error:
Line 8: var db = Database.OpenConnectionString(connectionString,providerName);
Line 9: var selectQueryString = "SELECT TypeName FROM TypeList";
Line 10: var selectedData = db.Query(selectQueryString);
Line 11: }
Line 12:
And the code is updated as
var connectionString = "Data Source=" + Server.MapPath("/") + "ZPSCMS.accdb;";
var providerName = "Microsoft.ACE.OleDb.12.0";
var db = Database.OpenConnectionString(connectionString,providerName);
var selectQueryString = "SELECT TypeName FROM TypeList";
var selectedData = db.Query(selectQueryString);
var connectionString = "Provider=Microsoft.ACE.OleDb.12.0; Data Source=" + Server.MapPath("/") + "ZPSCMS.accdb;";
var providerName = "System.Data.OleDb";
Thanks a million. The step moves forwards to get another error as attached. However, I have searched it and install the AccessDatabaseEngine_X64 in my pc. Why does it insist ?
The 'Microsoft.ACE.OleDb.12.0' provider is not registered on the local machine.
Description:
An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: The 'Microsoft.ACE.OleDb.12.0' provider is not registered on the local machine.
Source Error:
Line 4: var db = Database.OpenConnectionString(connectionString,providerName);
Line 5: var selectQueryString = "SELECT TypeName FROM TypeList";
Line 6: var selectedData = db.Query(selectQueryString); Line 7: }
Line 8:
If you can open the databsae in Access and resave it as an Access 2003 format (mdb), you should be able to bypass the ACE problems by changing the connection string as follows:
var connectionString = "Provider=Microsoft.Jet.OleDb.4.0; Data Source=" + Server.MapPath("/") + "ZPSCMS.mdb;";
JerryJRXU
Member
9 Points
14 Posts
ERROR @ Query a .accdb
Nov 21, 2012 04:58 PM|LINK
Error is displayed as :
The database file may be corrupted. Run the repair utility to check the database file. [ Database name = C:\Users\Administrator\Documents\My Web Sites\Business-ZPSCMS\ZPSCMS.accdb ]
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlServerCe.SqlCeException: The database file may be corrupted. Run the repair utility to check the database file. [ Database name = C:\Users\Administrator\Documents\My Web Sites\Business-ZPSCMS\ZPSCMS.accdb ]
Source Error:
Line 8: var db = Database.OpenConnectionString(connectionString); Line 9: var selectQueryString = "SELECT TypeName FROM TypeList"; Line 10: var selectedData = db.Query(selectQueryString); Line 11: Line 12: }My code is as below :
var connectionString = "Data Source=" + Server.MapPath("/") + "ZPSCMS.accdb;"; var providerName = "Microsoft.Jet.OLEDB.4.0"; var db = Database.OpenConnectionString(connectionString); var selectQueryString = "SELECT TypeName FROM TypeList"; var selectedData = db.Query(selectQueryString);I don't understand why the error come out and how to fix it. May I know if any one can answer this error ?
RameshRajend...
Star
7983 Points
2099 Posts
Re: ERROR @ Query a .accdb
Nov 21, 2012 05:07 PM|LINK
After searching some documents, this issue may occur due to corrupted Vaio Messenger components and we need to uninstall Vaio Messenger. Please refer to the following links:
http://answers.yahoo.com/question/index?qid=20111020225823AArNjTU
http://social.msdn.microsoft.com/Forums/en-US/sqlce/thread/289fa079-25c6-449a-b12d-431225453376
Mikesdotnett...
All-Star
154955 Points
19872 Posts
Moderator
MVP
Re: ERROR @ Query a .accdb
Nov 21, 2012 06:31 PM|LINK
The problem is that while you have a variable for the ADO.NET provider, you have not specified the provider in the OpenConnectionString method call, so WebMatrix.Data.Database falls back on the SqlServerCe provider (which is what is throwing the exception).
Also, you have an accdb file, which must be connected via the ACE OleDb provider. You have set your providerName variable to point to the Jet provider, which will only work with Access mdb files. Either change the variable declaration as follows:
or save the file as an mdb file if you have not installed the ACE provider on the server. In either case, pass hte resulting variable ot the OpenConnectionString method:
Beginning ASP.NET Web Pages with WebMatrix | My Site | Twitter
JerryJRXU
Member
9 Points
14 Posts
Re: ERROR @ Query a .accdb
Nov 22, 2012 01:53 PM|LINK
Thanks for answer my question.
JerryJRXU
Member
9 Points
14 Posts
Re: ERROR @ Query a .accdb
Nov 22, 2012 01:55 PM|LINK
After I installed AccessDatabaseEngine_2010_x64, the error is changed as below.
Unable to find the requested .Net Framework Data Provider. It may not be installed.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: Unable to find the requested .Net Framework Data Provider. It may not be installed.
Source Error:
And the code is updated as
var connectionString = "Data Source=" + Server.MapPath("/") + "ZPSCMS.accdb;"; var providerName = "Microsoft.ACE.OleDb.12.0"; var db = Database.OpenConnectionString(connectionString,providerName); var selectQueryString = "SELECT TypeName FROM TypeList"; var selectedData = db.Query(selectQueryString);Mikesdotnett...
All-Star
154955 Points
19872 Posts
Moderator
MVP
Re: ERROR @ Query a .accdb
Nov 22, 2012 02:46 PM|LINK
Sorry - the first two lines should be as follows:
var connectionString = "Provider=Microsoft.ACE.OleDb.12.0; Data Source=" + Server.MapPath("/") + "ZPSCMS.accdb;"; var providerName = "System.Data.OleDb";Beginning ASP.NET Web Pages with WebMatrix | My Site | Twitter
JerryJRXU
Member
9 Points
14 Posts
Re: ERROR @ Query a .accdb
Nov 22, 2012 03:24 PM|LINK
Thanks a million. The step moves forwards to get another error as attached. However, I have searched it and install the AccessDatabaseEngine_X64 in my pc. Why does it insist ?
The 'Microsoft.ACE.OleDb.12.0' provider is not registered on the local machine.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: The 'Microsoft.ACE.OleDb.12.0' provider is not registered on the local machine.
Source Error:
Line 4: var db = Database.OpenConnectionString(connectionString,providerName); Line 5: var selectQueryString = "SELECT TypeName FROM TypeList"; Line 6: var selectedData = db.Query(selectQueryString); Line 7: } Line 8:RameshRajend...
Star
7983 Points
2099 Posts
Re: ERROR @ Query a .accdb
Nov 22, 2012 03:36 PM|LINK
Here's a discussion about this error, please refer to it and let me know whether it is worked for you.
HOW TO: FIX ERROR - "the 'microsoft.ace.oledb.12.0' provider is not registered on the local machine"
Best Regards
JerryJRXU
Member
9 Points
14 Posts
Re: ERROR @ Query a .accdb
Nov 22, 2012 03:52 PM|LINK
Thanks for suggestion. I installed another engine called,
2007 Office System Driver: Data Connectivity Components
http://www.microsoft.com/en-us/download/confirmation.aspx?id=23734
Now it moves forward as
Unrecognized database format 'C:\Users\Administrator\Documents\My Web Sites\Business-ZPSCMS\ZPSCMS.accdb'.
I'm investigating how it come.
Mikesdotnett...
All-Star
154955 Points
19872 Posts
Moderator
MVP
Re: ERROR @ Query a .accdb
Nov 22, 2012 08:14 PM|LINK
If you can open the databsae in Access and resave it as an Access 2003 format (mdb), you should be able to bypass the ACE problems by changing the connection string as follows:
var connectionString = "Provider=Microsoft.Jet.OleDb.4.0; Data Source=" + Server.MapPath("/") + "ZPSCMS.mdb;";Beginning ASP.NET Web Pages with WebMatrix | My Site | Twitter