简体   繁体   English

C#编程中的数据库

[英]Database in C# Programming

I am new to database in .NET Framework. 我是.NET Framework中的数据库新手。 I really wonder about the difference between Local database in Visual Studio and Database in Microsoft SQL Server. 我真的想知道本地数据库之间的Visual Studio和数据库中的Microsoft SQL Server的差异。 Could anyone explain me it? 有人可以解释一下吗? and when should we use it? 什么时候应该使用它?

LocalDB is created specifically for developers. LocalDB是专门为开发人员创建的。 It is very easy to install and requires no management, yet it offers the same T-SQL language, programming surface and client-side providers as the regular SQL Server Express. 它非常容易安装,不需要管理,但是它提供了与常规SQL Server Express相同的T-SQL语言,编程界面和客户端提供程序。 In effect the developers that target SQL Server no longer have to install and manage a full instance of SQL Server Express on their laptops and other development machines. 实际上,面向SQL Server的开发人员不再需要在其便携式计算机和其他开发计算机上安装和管理SQL Server Express的完整实例。 Moreover, if the simplicity (and limitations) of LocalDB fit the needs of the target application environment, developers can continue using it in production, as LocalDB makes a pretty good embedded database too. 此外,如果LocalDB的简单性(和局限性)满足目标应用程序环境的需求,则开发人员可以继续在生产环境中使用它,因为LocalDB也是一个很好的嵌入式数据库。

Read: Introducing LocalDB, an improved SQL Express 阅读: 介绍LocalDB,一种改进的SQL Express

Client-server, SQL Express 客户端服务器,SQL Express

If you set up a database with SSMS and connect to it via SQL Express then you don't have a local database that's part of your project, you have a database for which the server happens to be local to your workstation. 如果您使用SSMS设置数据库并通过SQL Express连接到该数据库,则您的项目中没有本地数据库,那么您的数据库恰好位于工作站本地。

Local database, SQL Express 本地数据库,SQL Express

If you set up a database with SSMS, dismount the database and add the file to your project, then you have a local database that uses a private instance of SQL Express. 如果使用SSMS设置数据库,请卸下数据库并将文件添加到项目中,那么您将拥有使用SQL Express专用实例的本地数据库。

Local database, Compact Edition 本地数据库,精简版

Actually you have three options. 实际上,您有三个选择。 The option you didn't describe is the one where you create a database with SSMS and then set up a connection to a file and select the MDB file that was created by SSMS (you will probably need to first dismount the database using SSMS to get SQL Express to release its file locks). 您未描述的选项是使用SSMS创建数据库,然后建立与文件的连接,然后选择由SSMS创建的MDB文件的选项(您可能首先需要使用SSMS卸除数据库才能获得该选项)。 SQL Express释放其文件锁)。 When you created this connection to a file, you will be prompted as to whether you want to connect to it where it is, or add it to your project. 当您创建与文件的连接时,系统将提示您是否要在文件中连接它,或将其添加到项目中。

A local database can take two forms, depending on how you create it. 本地数据库可以采用两种形式,具体取决于创建方式。 For detailed information, consult How to: Manage Local Data Files in Your Project. 有关详细信息,请参阅如何:在项目中管理本地数据文件。

Client-server, SQL Express 客户端服务器,SQL Express

If you set up a database with SSMS and connect to it via SQL Express then you don't have a local database that's part of your project, you have a database for which the server happens to be local to your workstation. 如果您使用SSMS设置数据库并通过SQL Express连接到该数据库,则您的项目中没有本地数据库,那么您的数据库恰好位于工作站本地。

Local database, SQL Express 本地数据库,SQL Express

If you set up a database with SSMS, dismount the database and add the file to your project, then you have a local database that uses a private instance of SQL Express. 如果使用SSMS设置数据库,请卸下数据库并将文件添加到项目中,那么您将拥有使用SQL Express专用实例的本地数据库。

Local database, Compact Edition 本地数据库,精简版

If you create a new database with the Visual Studio menus, you have a local Compact Edition database . 如果使用Visual Studio菜单创建新数据库,则将具有本地Compact Edition数据库。

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

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