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