使用Lan在两台计算机之间共享数据库 [英] Database sharing between two computer using Lan

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

问题描述

我需要知道如何使用VB.net 2008中的LAN连接另一个系统数据库(MS SQL Server 2005),以检索存储在远程计算机中的数据.此应用程序用于商店中的账单支付明细,此应用程序的主要流程是员工将使用vb.net客户端应用程序将数据存储在员工系统中,而管理员将通过LAN使用远程系统查看那些账单明细.

我的需要:
1)连接远程系统ms sql服务器数据库以访问我系统中的数据的代码是什么.

解决方案

您所需要的只是连接字符串.
使用服务器资源管理器"窗格在VS中建立连接:
1)打开服务器资源管理器.
2)右键点击数据连接"并选择添加连接"
3)在随后的对话框中,选择您的数据源和数据库,指定安全信息,然后按测试连接".按钮.
4)连接正常后,按确定"
5)在服务器资源管理器"窗格中突出显示您的数据库,然后查看属性"窗格.将显示一个连接字符串的工作示例,您可以将其复制并粘贴到您的应用程序或配置文件中.

这样一来,您就可以从两台计算机上访问数据库而没有任何问题.


正如OriginalGriff所写,唯一的区别在于连接字符串.您的应用程序是本地数据库还是远程数据库,基本上以相同的方式连接数据库.

您还可以用来定义连接字符串的一种很好的资源是 SQL Server 2005的连接字符串 [ ^ ]


i need to know how to connect the another system database (MS SQL Server 2005) using LAN in VB.net 2008 to retrieve the data stored in remote computer. this application used for bill payment detail in a shop, the main process this application is staff will store the data in staff system using vb.net client application, and admin will see those bill details using remote system by LAN.

my need:
1) what is the code to connect remote system ms sql server database to access data''s in my system.
this is to know how many data''s was there, when it was stored.

解决方案

All you need is the connection string.
Set up a connection in VS with the Server Explorer pane:
1) Open Server Explorer.
2) Right click "Data connections" and select "Add connection"
3) In the dialog that follows, select your DataSource, and database, specify the security info, and press the "Test connection" button.
4) When the connection works, press "OK"
5) Highlight your database in the Server Explorer pane, and look at the Properties pane. A working example of the connection string will be shown, which you can copy and paste into your app or config file.

That shoudl allow you to access the DB from both machines without any problems.


As OriginalGriff wrote the only difference is in the connection string. Your application connects the database basically the same way if it''s local or remote.

One good resource you can also use to define the connection string is Connection strings for SQL Server 2005[^]


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

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