forum

Home / DeveloperSection / Forums / Error while connecting to remote SQL Server database

Error while connecting to remote SQL Server database

Anonymous User 1838 14-Aug-2014

My problem is quite simple: I'm writing a WinForms app in .net 4.0 C# in Visual Studio 2010 it works nicely on my computer.

It connects to a remote SQL Server database using System.Data.SqlClient's SqlConnection.

When the program loads the first form it runs the following code:

SqlConnection ACconnection = new SqlConnection(String.Format(
        "Server=xxx.xx.xxx.xxx\\TEST;Database=REP01;User Id={0};Password={1};", User, Password));
private bool TestConnection()
{
    try
    {
        ACconnection.Open();
        lbl_connectionStatus.Text = "Server: Connected";
        lbl_connectionStatus.ForeColor = Color.FromArgb(0, 150, 30);
        ACconnection.Close();
        return true;
    }
    catch (Exception ex)
    {
        Functions.GetError(ex);
        return false;
    }           
}

I get the error:

SQL Network Interfaces, error: 26

My problem is that even though it is working fine on my computer it won't work nearly anywhere else. All the computers I've tried it are running on Windows 7 or 8, including mine.

I've googled the error, but all the answers focus on the server side, and since it's working fine from my computer I know it's not a server side problem.


c# c# 
Updated on 14-Aug-2014
I am a content writter !

Can you answer this question?


Answer

1 Answers

Liked By