I created a new ASP.NET web application in VS2017 as blank and installed Entity Framework in it and all important libraries.
Problem is:
Enable-Migrations
Add-Migration Initialize
update-database
because I can't connect to SQL Server Express just from this project web.config
file because I start from scratch I add a connection string as follows:
<connectionStrings> <add name="DefaultConnection" connectionString="Server=OJ-PC\\OJ_SQLEXPRESS;Database=OrdersDb;User Id=sa;Password=******;" providerName="System.Data.SqlClient" /> </connectionStrings>
I tried a lot of connection strings. I get connection string from SQL Server and add it exactly. I tried same connection string that worked in other project but it didn't work in this project.
Thanks for help!
The .
(dot) alias is used when you deal with SQL Server Professional edition.
When it comes to dealing with SQL Express the server name consists of 2 parts separated by backslash \\
.
For instance
DESKTOP-3PQ45JH\SQLEXPRESS
In this case DESKTOP-3PQ45JH
is the name of computer, SQLEXPRESS
is the name of server instance.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.