如何运行在LAN上使用SQL数据库的Windows应用程序 [英] How do I run windows application which uses SQL database on a lan

查看:68
本文介绍了如何运行在LAN上使用SQL数据库的Windows应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好。

我在VS2008上创建了一个Quiz Windows应用程序,它主要在sql数据库的帮助下运行。如何在局域网上安装它。如何在服务器和客户端机器之间建立连接以在服务器和客户端之间传输和访问数据库。请给我一些建议。

提前谢谢。



我尝试了什么:



我在一台服务器机器上安装了服务器应用程序,在局域网上的其他机器上安装了客户端应用程序。我为客户端和服务器应用程序提供了相同的连接字符串,即data source = servername \sqlexpress,以便所有数据都存储在服务器计算机中。但是数据存储在服务器计算机中,但它没有传递给客户端计算机。

Hello.
I have created a Quiz windows application on VS2008 which runs mainly with the help of sql database. How do I install it on a lan . How to make connection between server and client machine to transfer and access database between server and client. Please give me suggestion on it.
Thank You in advance.

What I have tried:

I have installed server app in one server machine and client app in other machines on lan. I have given same connection string for both client and server application ie data source=servername\sqlexpress, so that all the data are stored in server machine. But data are stored in server machine but it does not pass to the client machine.

推荐答案

假设您在LAN上安装了SQL Server或MySql,并且您的数据库已经存在已添加到服务器中,应该只是为您的软件提供正确的连接字符串来访问服务器,就像您在开发计算机上开发应用程序时一样。

希望您仔细编写应用程序,并将连接字符串存储在配置或设置文件中,而不是硬编码到应用程序中,如果是这样,它应该很简单,可以更改字符串。



你应该使用什么字符串?我不知道 - 我们无法访问网络,更不用说Server实例了,所以我们不能具体。

这可能会有所帮助:简单的SQL连接字符串创建 [ ^ ]
Assuming you have SQL Server or MySql installed on the LAN, and your database has been added to the server, it should be just a case of providing your software with the correct connection string to access the Server, just as you had to when you were developing the app on your development machine.
Hopefully, you have written your app carefully, and your connection string is stored in a configuration or settings file rather than hardcoded into your application, and if so it should be simple enough to change the string.

What string should you use? I don't know - we don't have access to the network, much less the Server instance, so we can't be specific.
This may help though: Simple SQL Connection String Creation[^]


首先,您需要将SQL Server配置为使用 TCP连接(默认端口1433),请参阅此处的说明:配置服务器以侦听特定的TCP端口Microsoft Docs [ ^ ]

这篇文章是为了帮助您入门:Beginners指导通过C#访问SQL Server [ ^ ]

您也可能对此处的 System.Data.SqlClient 示例感兴趣: [ Dotnetperls ]
First you will need to configure SQL Server to use TCP connections (default port 1433), see instructions here: Configure a Server to Listen on a Specific TCP Port | Microsoft Docs[^]
Here is an article to get you started: Beginners guide to accessing SQL Server through C#[^]
You also might be interested in the System.Data.SqlClient examples here: [Dotnetperls]


这篇关于如何运行在LAN上使用SQL数据库的Windows应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆