Error trying to access a remote database in SQL Server with C#

25 Views Asked by At

I am trying to access a database I have recently developed remotely from another computer but on the same network. However, I always get the same error when trying to connect the database to the system built from C#:

System.Data.SqlClient.SqlException: 'Network-related or instance-specific error while establishing a connection to SQL Server. The server was not found or was not reachable. Check that the instance name is correct and that SQL Server is configured to support remote connections.

I am using the following code to access from the C# project (the IP is an example, it is not real):

private readonly string connectionString;
//Conexión a la base de datos del sistema en el servidor
public ConnectionToSql()
{
    connectionString = "Server=192.168.10.10;Database=CALIDAD_DB_KPI; integrated security= true";
}

//Obtener conexión de la base de datos del sistema
protected SqlConnection GetConnection()
{
    return new SqlConnection(connectionString);
0

There are 0 best solutions below