Connection String related error - c#

I'm using Windows authentication for SQL Server in my project and the error I receive while saving the data is:
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)
My connection string is:
Server=LOKESH; Initial Catalog=test; Integrated Security=SSPI

Related

Validating the user role in a view asp mvc 5

I am conducting a validation role in this line of view
#if (User.IsInRole("Admin"){}
or
#if (Role.IsUserInRole("Admin"){}
When I run it locally it works fine, but on the web this generates the following 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)
I connect the database from my local server and it does not generate an error
I could give a hand, thanks

Jumbox server connection

I have follow situation. I connect on a jumpbox server with my account domain\username and password from my computer. On jumpbox server I connect from SQL Server Management Studio on others servers, where I have databases, using Windows Authentication.
I want to write a Windows application on my computer that connect to databases but I receive this 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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)"
I put my domain on Window Credential and on application I use this string to
connect: connetionString="Server=myServerDatabase ;
Database= myDatabase; Integrated Security=SSPI; User
ID=myDomain/username;Password=MyPass"
If you have others idea how to connect or if it's possible to pass from jumpbox server and then connect to database server and then to database.

Reading content from MS Access db using ADO.net and trying to insert the values into a SQL Server table

I'm using an OleDb connection to read a table in MS Access. I've closed the connection and I'm trying to insert the values retrieved into a SQL Server table using Entity Framework.
While establishing the connection to SQL Server, I'm getting an 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)
The error message is crystal clear: the server was not found. So, take this two steps.
Verify your connection string for misspelled server name.
Verify your SQL Server instance is accepting connections from network, what is disable by default.
Go to:
Start > All Programs > SQL Server 2005 > Configuration Tools > SQL Server Surface Area Configuration
Click on Surface Area Configuration for Services and Connections
Select the instance that is having a problem > Database Engine > Remote Connections
Enable local and remote connections
Restart instance
See this article:
http://www.sswug.org/articlesection/default.aspx?TargetID=44331

error in connect to sqlserver in windows and sql authentication mode

i have a snippet that it work properly when i use windowsmode with follow connection string
data source=.;database=xDB;integrated security=true;
but i have to change it for sql and windows mode i changeit to
Data Source=.;Initial Catalog=xDB;User Id=krs;Password=12345;
but follow error occur
Login failed for user 'krs'. The user is not associated with a trusted SQL Server connection.
and when change dot(.) to(local) another error occur
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)
plz help me im beginer n confused.thank
You have to enable the Named Pipe & TCP/IP in SQL Server configuration. Go through following link to enable that
http://www.triostechs.com/Microsoft-SQL-Server-2008/Microsoft-SQL-Server-2008-Enable-TCP/IP-or-Named-Pipes.html
Also Make sure, only one instance of the SQL Server running. If it is more than one, just verify which one you are connecting to.

How to give database access to a program?

I created an MVC application that accesses my SQL Server database using LinqToSql. But I get an exception on dbGuestbookContext.SubmitChanges();
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)
I can access other databases on that server from other applications.
Could you please tell what I can do about this?
Thaks.

Categories

Resources