我是一个相对新手的ASP.net开发者(只有两周的基础应用经验),我的数据库出现了一个大问题。
我正在构建一个简单的电子邮件应用程序,其中包括登录系统。几天前一切都很正常。
但不知怎么的,每次尝试使用程序访问数据库文件时,我都会遇到以下错误:
*Server Error in '/' Application. The database file may be corrupted. Run the repair utility to check the database file. [ Database name = C:\Users\ArvinAsus\Documents\Visual Studio 2010\Projects\mailer\App_Data\Database.mdf ] 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\ArvinAsus\Documents\Visual Studio 2010\Projects\mailer\App_Data\Database.mdf ]*
每个数据库都会显示这个错误,无论我使用过去曾经工作过的数据库还是只是创建一个新的空数据库。
我感觉这个问题与数据库损坏无关,而是与我遇到的另一个问题有关:
当我在服务器资源管理器中连接本地数据库时,我可以添加表格、填充数据、测试连接总是成功的。但是当我尝试通过我的程序连接数据库时:
*Exception Details: System.Data.SqlServerCe.SqlCeException: There is a file sharing violation. A different process might be using the file. [ C:\Users\ArvinAsus\Documents\Visual Studio 2010\Projects\mailer\App_Data\Database.mdf ]*
然后我关闭服务器资源管理器中的连接,错误就消失了,留下了一个损坏的错误。
我完全被这个问题卡住了。有没有人有想法可以帮助我解决问题?
提前感谢您。
PS:我正在使用Visual Studio 2010专业版。
我正在构建一个简单的电子邮件应用程序,其中包括登录系统。几天前一切都很正常。
但不知怎么的,每次尝试使用程序访问数据库文件时,我都会遇到以下错误:
*Server Error in '/' Application. The database file may be corrupted. Run the repair utility to check the database file. [ Database name = C:\Users\ArvinAsus\Documents\Visual Studio 2010\Projects\mailer\App_Data\Database.mdf ] 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\ArvinAsus\Documents\Visual Studio 2010\Projects\mailer\App_Data\Database.mdf ]*
每个数据库都会显示这个错误,无论我使用过去曾经工作过的数据库还是只是创建一个新的空数据库。
我感觉这个问题与数据库损坏无关,而是与我遇到的另一个问题有关:
当我在服务器资源管理器中连接本地数据库时,我可以添加表格、填充数据、测试连接总是成功的。但是当我尝试通过我的程序连接数据库时:
*Exception Details: System.Data.SqlServerCe.SqlCeException: There is a file sharing violation. A different process might be using the file. [ C:\Users\ArvinAsus\Documents\Visual Studio 2010\Projects\mailer\App_Data\Database.mdf ]*
然后我关闭服务器资源管理器中的连接,错误就消失了,留下了一个损坏的错误。
我完全被这个问题卡住了。有没有人有想法可以帮助我解决问题?
提前感谢您。
PS:我正在使用Visual Studio 2010专业版。