0

I have a connection string that includes the absolute path to my database.

Here's my connection string:

// removed

I have 2 questions:

  1. How do I convert the absolute path to look at my app_data folder instead of adding a full string?
  2. Is this a good /bad thing to do?

Thanks in advance.

1 Answer 1

1

You should be able to use the |DataDirectory| substitution string:

AttachDbFilename=|DataDirectory|MyDb.mdf

MSDN Link

Sign up to request clarification or add additional context in comments.

Comments

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.