Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the default connection to a server in Visual studio 2012 SQL Project?

In visual studio 2012 sqlproj, the default connection button always connect to the (localdb)\Projects by default. How do I change that? Every time I need to disconnect and connect again to change the server.

like image 255
suresh2 Avatar asked Jan 23 '13 16:01

suresh2


People also ask

How do I change my database connection?

In Change Database Connection, select the item, and then click OK. In Find all references to the Database Connection, select the database connection to change. In Replace With, select a database connection. To create a new database connection, click New Database Connection.

How do I create a database connection in Visual Studio?

On the View menu, select Other Windows > Data Sources. In the Data Sources window, click Add New Data Source. The Data Source Configuration Wizard opens. Select Database on the Choose a Data Source Type page, and then select Next.


2 Answers

Check the properties of your database project. Under Debug tab, there's option "Target Connection String". Change that to the server and database you want to use.

like image 58
Yang Avatar answered Sep 20 '22 13:09

Yang


To change default connection

  1. On the menu, choose Tools-> Options -> Database tools
  2. On the data connections enter the SQL server Instance name that you want to use
  3. Press OK

this is from http://xprog.blogspot.com/2012/08/visual-studio-2012-change-default-sql.html

To change connection on a file by file basis

This worked for me. I had a sql file with BuildAction=Build and it was missing the sql connection toolbar.

  1. in solution explorer, click on the sql file
  2. change its BuildAction to None
  3. open the file (if its already open, close and reopen)

now you will get the connection toolbar.

you will have to remember to change the build action back when you are done with your maintenance.

like image 22
BraveNewMath Avatar answered Sep 21 '22 13:09

BraveNewMath