added migration , but database is not created - sql-server

migration is added and the connection string is correct but the database is not created
what should i do
help me please
i closed the sql server and re-opened it but nothing is changed
my connection string :
<connectionStrings>
<add name="DefaultConnection" connectionString="Data Source=.;
Initial Catalog=Final_BD;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
http://i.stack.imgur.com/SR3Qf.png
when i try updata-database it shows me an error message :
" A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) "
http://i.stack.imgur.com/9oQOR.png

Try changing your connection string as:
"Data Source=.\SQLSERVER;
Initial Catalog=Final_BD;Integrated Security=True"
providerName="System.Data.SqlClient"

when i try updata-database it shows me an error message :
" A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) "
http://i.stack.imgur.com/9oQOR.png

Related

LocalDB connection string to v14 SQL

I created a DB like this:
C:\Users\user>sqllocaldb create demo
LocalDB instance "demo" created with version 14.0.1000.169.
C:\Users\user>sqllocaldb info demo
Name: demo
Version: 14.0.1000.169
Shared name:
Owner: PC\user
Auto-create: No
State: Running
Last start time: 13/03/2020 11:11:43
Instance pipe name:
C:\Users\user>
I Can connect to it with SQL Server 2017 Management studio using
(LocalDB)\demo
Windows Authentication
But I'm failing to create a connection string that can be used locally from within EF Core.
Some of my failed attempts:
"Data Source=(LocalDB)/demo;Initial Catalog=Catalog1;Integrated Security=True;"
"Data Source=(LocalDB)\demo;Initial Catalog=Catalog1;Integrated Security=True;"
"Data Source=.;Initial Catalog=(LocalDB)/demo;Integrated Security=True;"
"Data Source=.;Initial Catalog=(LocalDB)\demo;Integrated Security=True;"
"Data Source=.;Initial Catalog=demo;Integrated Security=True;"
"Data Source=.;Initial Catalog=demo;Integrated Security=True;"
This is always the error I get:
System.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
System.ComponentModel.Win32Exception (53): The network path was not found
The instance is started, and SSMS can connect to it seamlessly, I think the only problem is that I don't know how to write the connection string properly
Attempt 2
Connections strings
"Server=(localdb)\\mssqllocaldb;Database=demo;Trusted_Connection=True;"
Tryied to add a user and use its credentials
CREATE LOGIN DEMO WITH PASSWORD = 'DEMO';
create user demoUser for login DEMO
And then tried to authenticate
"Server=(localdb)\\mssqllocaldb;Database=demo;Trusted_Connection=True;User Id=demoUser;Password=DEMO"

A network-related or instance-specific error occurred while establishing a connection to SQL Server. No SQL Express on server manager

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
Anyone can help me with this? I am using SQL Management Studio 2012. I already tried opening sql server manager but I dont see any SQLEXPRESS server in there. Im just using localdb. Sorry guys im just a newbie in web development.
This is my connection string
add name="MyCon2"
connectionString="Server=Villar-PC\Justin;Database=DBNAME; Integrated Security=true;>
Run services.msc and check sql server (or express depending on what you have) service. It should be running. If not, start it and check.
Also check if the database you are mentioning exists
Edit: If you are using sql localdb, you can refer to http://www.asp.net/mvc/overview/getting-started/introduction/creating-a-connection-string for the connection string
<add name="MovieDBContext"
connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\Movies.mdf;Integrated Security=True"
providerName="System.Data.SqlClient"
/>

Connect to external SQL Server through Entity Framework

Basically I need to test a database on an external server (the model matches the model of my local test database).
Here is the connection string I have so far:
<connectionStrings>
<add name="DefaultConnection"
connectionString="Database=QualityLinkBuilder;Server=12.345.678.901.\SQLExpress;uid=RemotePc\Administrator;pwd=MyPassword;"
providerName="System.Data.SqlClient" />
</connectionStrings>
When I attempt to connect now I get the generic error:
The underlying provider failed on Open.
Inner exception message:
A network-related or instance-specific error occurred while
establishing a connection to SQL Server. The server was not found or
was not accessible. Verify that the instance name is correct and that
SQL Server is configured to allow remote connections. (provider: SQL
Network Interfaces, error: 26 - Error Locating Server/Instance
Specified)
It should be just Server=12.345.678.901\SQLExpress in your connection string ( replace "\SQLExpress" with the relevant SQL Server instance name on the external server )

Error when trying to establish a MVC connection to SQL Server 2012 (localdb) running on my PC

I have set up my web.config like this:
<add name="DefaultConnection" connectionString="Data Source='C:\Users\Marilou\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances\v11.0\authentication.mdf';Initial Catalog=javacert;Persist Security Info=True;User ID=sa;Password=yyy" providerName="System.Data.SqlClient" />
But I am getting the message:
Message=The provider did not return a ProviderManifestToken string.
Source=EntityFramework
StackTrace:
at System.Data.Entity.Core.Common.DbProviderServices.GetProviderManifestToken(DbConnection connection)
at System.Data.Entity.Utilities.DbProviderServicesExtensions.GetProviderManifestTokenChecked(DbProviderServices providerServices, DbConnection connection)
InnerException: System.Data.SqlClient.SqlException
HResult=-2146232060
Message=A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
Source=.Net SqlClient Data Provider
ErrorCode=-2146232060
Seems like you are using LocalDB. From this MSDN article (http://blogs.msdn.com/b/sqlexpress/archive/2011/07/12/introducing-localdb-a-better-sql-express.aspx), the connection string is as follows :
Data Source=(localdb)\v11.0;Integrated Security=true;AttachDbFileName=C:\MyData\Database1.mdf".

Live Server - A network-related or instance-specific error

My site's login / membership doesn't work on the live server, when hosted. I get this infamous error:
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
My connection string is as follows:
<add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient" />
What am I doing wrong?
Thanks for any help.
you need check TCP/IP properties
in sql server configuration

Resources