如何在两台计算机之间共享数据库 [英] how to share database between two computers

查看:233
本文介绍了如何在两台计算机之间共享数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何使用C#.net 2010中的LAN将管理系统数据库文件(.mdf)连接到客户端系统(MS SQL Server 2008)。此应用程序用于付款详细信息,此应用程序的主要流程是员工将使用C#.net客户端应用程序将数据存储在人员系统中,管理员将通过LAN使用管理系统查看这些详细信息。





1)将管理系统ms sql server数据库(.mdf)连接到客户端系统以存储数据的代码是什么。

2)客户端存储的数据将被检索并在管理系统中查看。

I want to know how to connect the admin system database file(.mdf) to client system (MS SQL Server 2008) using LAN in C#.net 2010. This application used for payment detail, the main process this application is staff will store the data in staff system using C#.net client application, and admin will see those details using admin system by LAN.


1) what is the code to connect admin system ms sql server database(.mdf) to client system to store data.
2) Client Stored data will be retrieved and see in admin system.

推荐答案

您好
您可以在任何编号中使用相同的数据库。计算机,

只需使用ip地址和实例名称,sql用户名和密码。





For 1st问题



查看此链接



https://www.youtube.com/watch?v=Fn34ygvCKmQ [ ^ ]



如果数据库在服务器机器上,那么你需要使用sql身份验证,使用sql用户名和数据库连接中的密码,你没有指定是在web或Windows应用程序。



这是用于web,在webconfig中你需要在connectionStrings标签之间添加这个



Hi U can use same database in any no. of computers,
just use ip address and instance name,sql username and password.


For 1st question

check this links

https://www.youtube.com/watch?v=Fn34ygvCKmQ[^]

If database in server machine ,then u need to use sql authentication,using sql username and password in database connection,u didnt specify whether in web or windows application.

This is for web,in webconfig u need to add this in between connectionStrings tag

<add name="ConnectionString" connectionString="Data Source=192.168.0.1\sqlserver;Initial Catalog=DatabseName;User ID=scott;Password=sa" providerName="System.Data.SqlClient" />





这是在Windows应用程序中



This is in windows application

<userSettings>
     <Perfrom.My.MySettings>
         <setting name="CS" serializeAs="String">
             <value>Data Source=192.168.0.1\sqlserver;Initial Catalog=DatabaseName;User ID=scott;Password=a</value>
         </setting>
        </Perfrom.My.MySettings>
 </userSettings>





第二个问题



您将使用管理系统sql sever,所以肯定客户端存储的数据也会出现在管理系统sql server中。



问候

Aravind



For 2nd question

You are going to use admin system sql sever,so definitely client side stored data will appear in admin system sql server also.

Regards
Aravind


不确定我是否正确理解了该问题,但为了正确设置多用户数据库,只能在一台计算机上安装SQL Server。这台计算机通常根本没有安装实际的应用程序。



运行客户端的计算机使用客户端库访问单个数据库服务器,客户端计算机(或应用程序)应该不知道数据在数据库服务器上的位置或任何其他物理细节。



您拥有的MDF文件是什么,如果是系统数据库,则无法在另一台计算机上使用它。系统数据库特定于安装。如果它是与另一个数据库分离的数据库文件,则可以将其附加到SQL Servre中。
Not sure if I understand the question correctly, but in order to properly set up a multi user database, you install the SQL Server only on one computer. This computer often does not have the actual application installed at all.

Computers running the client access the single database server using a client library, Client computers (or applications) should have no knowledge where the data is located on the database server or any other physical details.

What comes to the MDF file you have, if it is a system database, you can't use it on another computer. System database is installation specific. If it is a database file detached from another database, you can attach it into your SQL Servre.


这篇关于如何在两台计算机之间共享数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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