A new database LocalDB for visual studio2012

Source: Internet
Author: User
Tags sql server express connectionstrings

Http://www.cnblogs.com/zhangran/archive/2012/08/21/2649200.html

Today in vs2012 Open the previous MVC3 project, the results pop-up warning that the database in the vs2012 is not recommended to use SQL Server Express but instead of using LocalDB. So I did a little understanding of localdb.

LOCALDB is a lightweight SQL Server Express that basically accomplishes the latter but does a lot of simplification. I installed the vs2012 when the full installation, all the plug-ins are checked (make a suggestion if the. NET developer or the C drive to reserve a larger space, my is 70G). In this case, LocalDB already exists on your computer.

Note that if your computer is 64-bit like me, then the tool is installed under the 64-bit Program Files folder instead of Program Files (X86). Locate this directory C:\Program Files\Microsoft SQL Server\110\tools\binn. There's a SqlLocalDB.exe file in it. This is the command-line tool.

Open cmd. Navigate to the directory: Enter Sqllocaldb.exe/?, as shown below

In fact, you will know the basic usage of the overview database by scrolling up and down.

Common methods:

Add sqllocaldb keyword before any operation;

SQLLOCALDB Create MYBD creates a database with the name "MyDB". Don't add ";" at the end of the sentence.

Sqllocaldb start MyDB enable the DB instance

Sqllocaldb Stop MyDB Stopping the instance

Sqllocaldb Delete MyDB deleted

SQLLOCALDB Info mydb View database information

Sqllocaldb Versions View version

In addition, if you do not specify the string you want to use in visual studio2012, the LOCALDB database will be used by default. You can create a project with a normal ASP mvc3. Select an Internet project, which by default will have a small database to store user account information. After executing the code, open Web. config.

<connectionStrings>
<add name= "defaultconnection" providername= "System.Data.SqlClient" connectionstring= "Data source= (LocalDb) \ V11.0;initial catalog=aspnet-abc-20120821160659;integrated Security=sspi; attachdbfilename=| Datadirectory|\aspnet-abc-20120821160659.mdf "/>
</connectionStrings>

From the connection string behind connectionstring, you can see that the LOCALDB database is used.

A new database LocalDB for visual studio2012

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.