一般我們能過VS2005的SQL explorer來新增一個本地的MDF檔。也許你可能會出現下面這個問題:
Exception Details: System.Data.SqlClient.SqlException: The user instance login flag is not supported on this version of SQL Server. The connection will be closed.
透過搜尋。發現這裡有我們所需要的資訊:Error Message: The user instance login flag is not supported on this version of SQL Server. The connection will be closed
仔細分析Scott的回答:
"The issue is that User Instancing, which allows the auto allow creation of databases from code, isn't support on the full version of SQL 2005. That is a function of SQL Express only. The solution is to manually create the database in SQL Server 2005 and set a connection string to point to string. will also need to run aspnet_regsql.exe manually against the database if you
will be using any of the new built-in database features of ASP.NET v2.0."因此,如果我們不是使用的從MS下載下來的SQL Server 2005 Express,那我們只能過在SQL2005管理器上把MDF檔案加進去在連接它。
解決方法:在SQL2005管理器上,透過Attach(附加)本地的MDF檔案成功之後。在VS2005的sql explorer的連線即可。
以後繼續補充。
cnzc's blogs