简体   繁体   English

C#应用使用SQL服务器数据库

[英]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 的组件。

If you need a local sql server on each pc where your application runs then you should look into the Express edition of MS SQL Server.如果您在运行应用程序的每台电脑上都需要一个本地 sql 服务器,那么您应该查看 MS SQL 服务器的Express版本。 It is the free with limitations version of MS SQL Server.它是 MS SQL 服务器的有限制的免费版本。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 用SQL Server数据库部署C#应用程序? - C# application deployment with sql server database? 使用C#和SQL的客户端服务器应用程序 - Client Server Application using C# and SQL 使用C#连接到SQL Server数据库 - Connecting to SQL Server database using C# 使用C#还原SQL Server数据库 - Restore SQL Server database using C# 使用C#应用程序远程访问使用SQL Server 2014 Management Studio创建的数据库 - Remote access using C# application to database created using SQL Server 2014 Management Studio 使用C#创建的NHibernate从多个应用程序向SQL Server数据库进行事务处理 - Transactions to a SQL Server database from multiple application using NHibernate created with C# 使用SMO备份带有C#Windows Forms应用程序的SQL Server 2005数据库时,备份失败 - Using SMO to backup SQL Server 2005 Database with C# Windows Forms Application, Back up failed 使用 Active Directory 帐户将 C# 应用程序连接到 Azure SQL 服务器数据库的最简单方法是什么? - What is the easiest way to connect a C# application to an Azure SQL server database using an Active directory Account? API 数据导入到 SQL 服务器数据库,使用用 C# 编写的控制台应用程序 - API data import into SQL Server database using console application written in C# 如何使用C#在Windows窗体应用程序中的SQL Server Compact数据库中搜索? - How to Search in SQL Server Compact Database in windows form application using C#?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM