我在我的網站上建立了一個註冊頁面在VS2010中,當我填寫表單在點擊註冊時,我收到以下錯誤。幫助將不勝感激。插入錯誤:目錄查找文件
System.Exception was unhandled by user code
Message=Insert Error:Directory lookup for the file "C:\Users\myname\Documents\myname\Project\App_Data\SJDatabase.mdf" failed with the operating system error 5(error not found).
Cannot attach the file 'C:\Users\myname\Documents\myname\Project\App_Data\SJDatabase.mdf' as database 'SJDatabase'.
連接字符串:
<connectionStrings>
<add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient"/>
<add name="MyConsString" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|SJDatabase.mdf;
Initial Catalog=SJDatabase;
Integrated Security=SSPI;"
providerName="System.Data.SqlClient" />
</connectionStrings>
你確定路徑'C:\ Users \ myname \ Documents \ myname \\ Project \ App_Data'存在嗎? – GolfWolf 2012-04-11 14:14:09
你可以發佈你的一些代碼嗎?連接字符串主要是 – Diego 2012-04-11 14:14:41
@ w0lf是的,它確實存在,輸入錯誤,請查看更新的版本。 – user1300580 2012-04-11 14:22:54