简体   繁体   English

C#:客户端计算机是否需要安装SQL Server,同时连接到安装了SQL Server的其他计算机(服务器计算机)

[英]C# :Does Client machine need SQL Server installed on it while connecting to other machine having SQL Server installed on it (the Server machine)

I have written an C# windows application form which runs on a client machine and connects to SQL server on another machine.While building the connection in C# i have used dlls like 我编写了一个C#windows应用程序表单,它在客户端计算机上运行并连接到另一台机器上的SQL服务器。虽然在C#中构建连接,但我使用了dll之类的

1)microsoft.sqlserver.management.smo. 2)microsoft.sqlserver.management.connectioninfo 3)microsoft.sqlserver.management.sdk.sfc

The client machine on which the aplication was built was having sql server installed on it. 构建应用程序的客户端机器上安装了SQL Server。 so importing and accessing dlls was not a problem. 所以导入和访问dll不是问题。

However on the other client machine on which i am going to run the C# windows application would not be having SQL server installed on it. 但是在我要运行的其他客户机上,C#windows应用程序将不会安装SQL服务器。

So will it cause a problem.Will the connection fail on that client machine due to absence of sql server. 因此,它会导致问题。由于缺少sql server,连接将在该客户端计算机上失败。

If yes, what could be the way around to solve the problem without installing sql server on that client machine. 如果是的话,如果不在该客户端计算机上安装sql server就可以解决问题。

PS: I am asking beforehand to avoid the last minute hassle on the day of installation. PS:我事先要求避免安装当天的最后一刻麻烦。

The pieces needed to connect to SQL server are built into the .net framework. 连接到SQL服务器所需的部分内置于.net框架中。 As long as you used those when coding the client piece you can connect to a SQL Database without MSSQL installed on the client. 只要您在编写客户端部分时使用它们,就可以连接到客户端上没有安装MSSQL的SQL数据库。

using System.Data;
using System.Data.SqlClient;

SqlClient 的SqlClient

PS: I am asking beforehand to avoid the last minute hassle on the day of installation. PS:我事先要求避免安装当天的最后一刻麻烦。

You should always test locally first. 您应该始终首先在本地测试。 You can probally get your hands on a random test machine to verify that everything is good to go. 您可以在随机测试机器上轻松掌握,确认一切顺利。

So will it cause a problem.Will the connection fail on that client machine due to absence of sql server. 因此,它会导致问题。由于缺少sql server,连接将在该客户端计算机上失败。

No, as long as you have all the required dll's installed along with your application. 不,只要您在应用程序中安装了所有必需的dll。

connects to SQL server on another machine 连接到另一台计算机上的SQL Server

Not a good option though. 虽然不是一个好的选择。 I would recommend you to use some middle layer to connect to database. 我建议你使用一些中间层来连接数据库。 Perhaps web services. 也许是网络服务。 Something of the following architecture. 以下架构的东西。

GUI-->Webservices-->DataBase

You need to make sure you deploy the Server Management Objects Redistributable ( SharedManagementObjects.msi ) when you install on the client machine. 在客户端计算机上安装时,需要确保部署服务器管理对象可再发行组件SharedManagementObjects.msi )。

This will install the SMO classes without having to install a full Sql Server install. 这将安装SMO类,而无需安装完整的Sql Server安装。

Microsoft SQL Server 2008 Management Objects Microsoft SQL Server 2008管理对象

The SQL Server Management Objects (SMO) is a .NET Framework object model that enables software developers to create client-side applications to manage and administer SQL Server objects and services. SQL Server管理对象(SMO)是一种.NET Framework对象模型,它使软件开发人员能够创建客户端应用程序来管理和管理SQL Server对象和服务。 This object model will work with SQL Server 2000, SQL Server 2005 and SQL Server 2008. 此对象模型将与SQL Server 2000,SQL Server 2005和SQL Server 2008一起使用。
Note: Microsoft SQL Server 2008 Management Objects Collection requires Microsoft Core XML Services (MSXML) 6.0 , Microsoft SQL Server Native Client, and Microsoft SQL Server System CLR Types. 注意: Microsoft SQL Server 2008管理对象集合需要Microsoft Core XML Services(MSXML)6.0 ,Microsoft SQL Server Native Client和Microsoft SQL Server System CLR类型。 These are available on this page. 这些可在此页面上找到。

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

相关问题 在目标计算机上运行脚本而不在该计算机上安装SQL Server - Running a script on a target machine without having SQL server installed on that machine 通过C#检查计算机上是否安装了SQL Server - Check if SQL Server is installed on a machine through C# 在客户端计算机上未安装 SQL Server Management Studio 的情况下运行 C# 应用程序 - Run C# application without SQL Server Management Studio installed on client machine 搜索计算机上安装的SQL Server数据库 - Search for SQL Server database installed on machine 登录失败,C# 应用程序/SQL Server 数据库安装在另一台机器上 - Login fails with C# application / SQL Server database installed in a different machine 客户端计算机上的SQL Server数据库 - SQL Server database on Client machine 如何列出安装在本地机器上的 SQL Server 实例? (仅限本地) - How to list the SQL Server Instances installed on a local machine? ( Only local ) 连接到另一台计算机上的特定SQL Server实例 - Connecting to a specific SQL Server instance on another machine 我需要在客户端计算机上安装SQL Server吗? - Do I need to install SQL Server on client machine? 如何在未安装SQL Server的计算机上使用其Sql Server数据库运行桌面应用程序 - How to run desktop application with its Sql Server database on a machine that have not SQL server installed
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM