Solved and remote sql server database

Posted on 2014-09-21
Last Modified: 2016-06-13
How do I add a sql server remote database connection to some code on my computer?
Question by:michaeldean99
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +3
LVL 14

Accepted Solution

quizwedge earned 200 total points
ID: 40335533
Are you looking to view the remote database in Visual Studio? If so, check out

If you're looking to add a connection string to your code so that your code can access the remote server, check out
LVL 12

Assisted Solution

by:Ramkisan Jagtap
Ramkisan Jagtap earned 100 total points
ID: 40335985
Modify your connection string as below :

  <add name="DefaultConnection" providerName="System.Data.SqlClient"
       connectionString="ServerName ,port;Integrated Security=False;User ID=XXXX;Password=XXXX" />

Expert Comment

ID: 40336287
It is same as you do for your local database. You have to provide remote SQL server instance name in connectionstring.
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

LVL 11

Expert Comment

ID: 40336574
You could also add a linked server.

Assisted Solution

by:Mandeep Singh
Mandeep Singh earned 100 total points
ID: 40338300

if sql server box is located on a remote area, then you have to open Port between two machines on which sql server is running.

also make a connection like this.

<?xml version="1.0"?>

      <compilation debug="true" targetFramework="4.5" />
      <httpRuntime targetFramework="4.5" />
    <add name="con" connectionString="Data Source=.;User ID=abc;Password=abc@123;Initial Catalog=AdventureWorks2008R2"/>


Author Comment

ID: 40347449
Using ms visual studio express 2013 for Web.
Have added the remote sql sever definition using the server explorer.
I assume that I have to add sql queries to the sql server object explorer?

Sample page
<!DOCTYPE html>
<html xmlns="">
    <title>xxxxxx</title>  etc.

    <table style="width:100%" align="center">.....
How do I add the query results to the code?

LVL 14

Assisted Solution

quizwedge earned 200 total points
ID: 40388025
Saw that no one has responded yet. There are a bunch of different ways to add database query results to the code.

Some people prefer LINQ (

You can also use data layers. See the YouTube video at starting at around 19:44

Yet another way is using OleDbDataAdapter (

I'd look over those three and choose the one that seems easiest and best for your project.

Author Comment

ID: 40396606
Linq seems to be the obvious
LVL 11

Assisted Solution

LordWabbit earned 100 total points
ID: 40396667
Well LINQ to SQL is a bit outdated (would still work though) the Entity Framework has replaced it.

Author Comment

ID: 40396784
thanks LordWabbit
Entity Framework looks interesting

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question