混淆本地数据库和基于服务的数据库 [英] Confused in Local Database and Service-Based Database

查看:91
本文介绍了混淆本地数据库和基于服务的数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用C#制作一个基于Windows的应用程序,并将SQL Server Management Studio用作数据库.
创建数据库时,它为我提供了两种添加数据库的选项:

1.本地数据库
2.基于服务的数据库.

我正在制作此应用程序,我想在其中将其安装在5台计算机上,并作为网络下的数据库安装在一台计算机上.

我应该使用哪个数据库?在安装它时,如何在我的Home中使用现在指向的数据库路径.

请帮助
谢谢

I am making an Windows based application with C# and using SQL Server Management Studio as Database.
When I''m creating a Database it is giving me 2 options for adding database as:

1. Local Database
2. Service-Based Database.

I am making this application in which I want to install the application in 5 Computers and on one computer as a Database under a Network

Which Database should I use? and while installing it how can I point the database path as right now I am using in my Home.

Please Help
Thanks

推荐答案

基于服务的数据库是只能通过服务器访问的数据库.它使用MDF数据文件,该文件是SQL Server格式.为了能够连接到SQL Server数据库,SQL Server服务必须正在运行,因为它可以处理您的请求并访问数据文件.

本地数据库是仅在您的应用程序本地的数据库.它使用SDF数据文件,该文件是SQL Server CE(精简版)格式.无需安装服务器即可访问SDF数据库.您只需将构成SSCE的DLL与您的应用程序一起分发,然后直接访问数据文件.

来源:(jmcilhinney)http://www.vbforums.com/showthread.php?t=530655


根据您的要求,我认为您需要一个基于服务的应用程序.这将安装在您的服务器上,然后您的客户端都将连接到该数据库.
A service-based database is a database that is only accessed through a server. It uses an MDF data file, which is SQL Server format. To be able to connect to a SQL Server database the SQL Server service must be running, because it''s that that processes your requests and access the data file.

A local database is one that is local to your application only. It uses an SDF data file, which is SQL Server CE (Compact Edition) format. There is no need to install a server to access an SDF database. You simply distribute the DLLs that constitute SSCE along with your app and access the data file directly.

source: (jmcilhinney) http://www.vbforums.com/showthread.php?t=530655


Based on your requirements, I think you''ll want a service based application. This would be installed on your server, your clients then all connect to this database.


服务数据库和本地数据库有什么区别..

基于服务的数据库是只能通过服务器访问的数据库.它使用MDF数据文件,该文件是SQL Server格式.为了能够连接到SQL Server数据库,必须运行SQL Server服务,因为它可以处理您的请求并访问数据文件."

本地数据库仅是应用程序本地的数据库.它使用SDF数据文件,该文件是SQL Server CE(精简版)格式.无需安装服务器即可访问SDF数据库.您只需分发SDF数据文件即可.与您的应用程序一起构成SSCE的DLL可以直接访问数据文件."

现在,您说您需要将应用程序安装到5 pc中,并且数据库位于服务器中,并且需要从本地5 pc中访问它.
因此,您需要使用包含MDF文件的服务数据库,并使用这样的连接字符串...

Data Source=192.168.3.225;Initial Catalog=Testing;Integrated Security=True

您需要在现有连接字符串中更改的是data source
像在此演示字符串中一样,您需要在data source
What is the Difference between Service Database and Local Database..

"A service-based database is a database that is only accessed through a server. It uses an MDF data file, which is SQL Server format. To be able to connect to a SQL Server database the SQL Server service must be running, because it''s that that processes your requests and access the data file."

"A local database is one that is local to your application only. It uses an SDF data file, which is SQL Server CE (Compact Edition) format. There is no need to install a server to access an SDF database. You simply distribute the DLLs that constitute SSCE along with your app and access the data file directly."

Now you say that you need to install your application into 5 pc and your database is located in server and you need to access that from your local 5 pc.. m i right..?

so you need to use a service database wich contains MDF file, and use a connection string like this...

Data Source=192.168.3.225;Initial Catalog=Testing;Integrated Security=True

what you need to change in your existing connection string is data source
like in this demo string you need to provide you database server ip in data source


这篇关于混淆本地数据库和基于服务的数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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