[英]C# application using SQL Server database
This might sound a silly question but I've really spend hours in trying to find a solution...这听起来可能是一个愚蠢的问题,但我真的花了几个小时试图找到解决方案......
I have a local database on SQL Server and it is used with a C# application.. The only way I view the database is through SQL Server.. It is accessible and altered in my application when I am running the application on my developing PC, but when I run it on another PC the database is not found (obviously).. How can I include the database sources when I am compiling the program, (so that it would be also found when I run it on other PCs)?我在 SQL 服务器上有一个本地数据库,它与 C# 应用程序一起使用。我查看数据库的唯一方法是通过 SQL 服务器。当我在开发中的 PC 上运行应用程序时,它可以在我的应用程序中访问和更改,但是当我在另一台 PC 上运行它时,找不到数据库(很明显).. 我如何在编译程序时包含数据库源,(这样当我在其他 PC 上运行它时也能找到它)?
Initially I used SQL Server CE and I achieved portability, but I had to include stored procedures, and this edition doesn't accept them:/ so I had to turn my attention to the latter type.最初我使用 SQL Server CE 并实现了可移植性,但我必须包含存储过程,而这个版本不接受它们:/ 所以我不得不将注意力转向后一种类型。
Sorry for my terrible English: :(对不起我糟糕的英语::(
Thanks in advance提前致谢
How can I include the database sources when I am compiling the program, (so that it would be also found when I run it on other PCs)?
我如何在编译程序时包含数据库源(以便在其他 PC 上运行时也能找到它)?
You can't.你不能。 SQL Server license prohibits distributing parts of it like that, plus there is no documented way to do that.
SQL 服务器许可证禁止像这样分发其中的一部分,而且没有记录的方法可以做到这一点。 If you need SQL Server on the box, it needs to come from the installer.
如果你需要 SQL 服务器在盒子上,它需要来自安装程序。 You can create an installer for your own product, and your installer can install SQL Server if it's needed as a prerequisite.
您可以为自己的产品创建安装程序,如果需要,您的安装程序可以安装 SQL 服务器。
Alternatively, you could look at other database options such as SQLite for a file-based database.或者,您可以查看其他数据库选项,例如基于文件的数据库的SQLite 。 You can distribute the components of SQLite.
您可以分发 SQLite 的组件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.