简体   繁体   English

如何使用MS SQL 2008和MS VStudio 2010 C#在LAN连接中设置数据库?

[英]How to set up a database in a LAN connection using MS SQL 2008 and MS VStudio 2010 C#?

I am making a LAN Chat and E-mail program ( Windows Forms Application ) in MS VStudio 2010 C# and it would run in a LAN. 我正在MS VStudio 2010 C#中制作局域网聊天和电子邮件程序(Windows窗体应用程序),它将在局域网中运行。

I was wondering how to set up a database for this. 我想知道如何为此设置数据库。 There would be a server computer and client computers. 将有一台服务器计算机和客户端计算机。

I also want to know how to access the database in the server from the client computers (ie what is the form of the connection string) 我还想知道如何从客户端计算机访问服务器中的数据库(即连接字符串的形式是什么)

Here is a great reference for all your connection string questions. 这是所有连接字符串问题的绝佳参考

A typical connection string will look like: 典型的连接字符串如下所示:

Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;

In this case myServerAddress would be the address of a server that the clients can reach. 在这种情况下, myServerAddress将是客户端可以访问的服务器的地址。 If you install Sql Server on that machine you will be able to access it from client machines. 如果在该计算机上安装Sql Server,则可以从客户端计算机访问它。

If you are using Sql Server Express , you have to make some configuration changes to your server machine because Express by default doesn't allow remote connections. 如果您使用的是Sql Server Express ,则必须对服务器计算机进行一些配置更改,因为Express默认情况下不允许远程连接。 You can find the info you need here 您可以在此处找到所需的信息

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM