3

I have an existing database in SQL Server. I am trying to create an asp.net mvc project around this db.

For this purpose I need to add the db to app_data folder of asp.net MVC project

How do I achieve this?

Note:

The SQL Server is in another system and I do not have rights to install SQL Server Express on my machine as well :(

1 Answer 1

4

You don't need to add app_data directory or install SQL Express on your machine. All you need is a connection string allowing you to connect to the remote database.

Data Source=NameOfDbServer;Database=DatabaseName;User ID=User;Password=PWD;Trusted_Connection=False

Once you have the connection string you can start querying the database. The way you do this will depend primary on the technology you would like to use: NHibernate, LINQ to SQL, LINQ To Entities, plain old ADO.NET, ...

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

2 Comments

do I need to add the connection string in web.config or any other file?
Externalizing the connection string in the connectionStrings section of the web.config is a good idea.

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.