由于复制数据库文件失败,无法生成SQL Server的用户实例。连接将被关闭 [英] Failed to generate a user instance of SQL server due to failure in copying database files.the connection will be closed
问题描述
我已经在winforms中开发了应用程序,但是当我打开n客户端机器时出现错误
由于复制数据库文件失败而无法生成sql server的用户实例。连接将关闭
请给我这个解决方案
我尝试过:
ConnectionString =Data Source = mypc\SQLEXPRESS;
AttachDbFilename = mydb.mdf;
Integrated Security = True;
用户实例=真;
I have develpoed application in winforms ,but when i open n client machine there are error occured
" failed to generate a user instance of sql server due to failure in copying database files.the connection will be closed"
please give me solution for this
What I have tried:
ConnectionString = "Data Source=mypc\SQLEXPRESS;
AttachDbFilename=mydb.mdf;
Integrated Security=True;
User Instance=True";
推荐答案
首先不附加数据库:这是一种特殊模式仅适用于Express版本,旨在用作开发辅助工具。如果要在多个客户端之间共享数据库,则无法附加它 - 它必须由SQL服务器直接托管和维护。
因此在SQL中创建一个新数据库并使用文件中的数据填充它,然后修改连接字符串以连接到它。
Start by not attaching the database: that is a special mode which is only available in Express editions and is intended as a development aid. If you want to share the DB between multiple clients, you cannot attach it - it must be hosted and maintained by SQL server directly.
So create a new database in SQL and populate it with data from your file, and then modify your connection string to connect to it.
这篇关于由于复制数据库文件失败,无法生成SQL Server的用户实例。连接将被关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!