一般我們能過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 automatic 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 it. You 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