英文:
how to make publish file in window form application with local .mdf file that work on any other pc
问题
我使用本地 Database.mdf 文件进行简单的 curd 操作,当我发布 .exe 文件时,在我的开发笔记本上正常工作,但当我移动到其他笔记本时,它给我这个错误。
我的连接字符串如下:
cn = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\Database1.mdf;Integrated Security=True");
英文:
i make simple curd operation with local Database.mdf file and when i make publish it .exe file work fine on my developement laptop but when i move to any other laptop it give me this error.
and my connection string look like this
cn = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\Database1.mdf;Integrated Security=True");
please help me if any one face this type issue in window form application thanks
答案1
得分: 1
你必须在目标计算机上安装SQL Server Express LocalDB。
如果您正在寻找一个真正自包含的数据库,可以将其与您的应用程序一起分发,并且无需任何远程服务器或特定设置即可运行,您可以尝试SQLite。
LocalDB 不是自包含的。
英文:
You must install SQL Server Express LocalDB on the target machine.
If you are looking for a truly self-contained database that can be shipped with your application and run "as-is" without any remote servers or specific setup, you could try <a href="https://www.sqlite.org/">SQLite</a>.
LocalDB is not self-contained.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论