views:

421

answers:

1

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  A: 

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, ...

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