---
title: "Error while connecting to remote SQL Server database"  
description: "Error while connecting to remote SQL Server database"  
author: "Anonymous User"  
published: 2014-08-14  
updated: 2014-08-14  
canonical: https://www.mindstick.com/forum/2040/error-while-connecting-to-remote-sql-server-database  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# Error while connecting to remote SQL Server database

My problem is quite simple: I'm [writing](https://www.mindstick.com/articles/12997/5-essential-tips-on-resume-writing-for-business-analysts) a WinForms app in .net 4.0 C# in [Visual Studio](https://www.mindstick.com/articles/12378/visual-studio-for-mac-is-out-of-beta-preview-now-officially-available) 2010 it works nicely on my computer.

It connects to a remote SQL [Server database](https://www.mindstick.com/forum/156824/what-is-normalization-in-sql-server-database) using System.Data.SqlClient's [SqlConnection](https://www.mindstick.com/forum/1209/sqlconnection-sqlcommand-sqldatareader-idisposable).

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](https://www.mindstick.com/articles/13122/an-introduction-to-network-cables) [Interfaces](https://www.mindstick.com/articles/12100/interfaces-in-java-real-life-example), error: 26

My problem is that even though it is [working fine](https://answers.mindstick.com/qa/95550/why-is-the-safari-browser-not-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](https://www.mindstick.com/forum/318/how-to-call-javascript-fuction-in-server-side), and since it's working fine from my computer I know it's not a server side problem.

## Replies

### Reply by Pravesh Singh

Hi Ankita, try this:

```
SqlConnection ACconnection = new SqlConnection(String.Format(    "Server=xxx.xx.xxx.xxx\\TEST,49232;Database=REP01;User Id={0};Password={1};", User, Password));
```


---

Original Source: https://www.mindstick.com/forum/2040/error-while-connecting-to-remote-sql-server-database

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
