3

What is the correct way to write a connection string for a SQL Server Database Project within the same solution?

My connection string defaults as

<connectionStrings>
<add name="DefaultConnection" connectionString="Data Source=(LocalDb)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\aspnet-PokemonDayCare-20170701121228.mdf;Initial Catalog=aspnet-PokemonDayCare-20170701121228;Integrated Security=True"
  providerName="System.Data.SqlClient" />
</connectionStrings>

That LocalDB doesn't actually exist, so it creates it once it needs it (I think it does because I'm using single user authentication?).

So I need to make sure it doesn't create another database if I get the connection string wrong.

Here are the properties for my database project (it sits in the same solution as my web app).

Project Properties

  • How do I create a connection string for the database project?

(sorry if it's stupid or painfully obvious)

1 Answer 1

4
  • In your solution explorer double click properties
  • Select the Debug Tab
  • Select Edit Under Target Connection String Setting
Sign up to request clarification or add additional context in comments.

1 Comment

That provides a list of recent connection, but it does not display the existing connection information.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.