balalakshmi
balalakshmi

Reputation: 4208

How to add existing SQL Server database to app_data folder of asp.net MVC project

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

Upvotes: 3

Views: 8900

Answers (1)

Darin Dimitrov
Darin Dimitrov

Reputation: 1038710

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

Upvotes: 4

Related Questions