Link to home
Start Free TrialLog in
Avatar of si2030
si2030

asked on

Two databases in my MVC ASP.NET movies tutorial

Hi there,

I am totally new to MVC and am doing the Movies tutorial on the ASP.NET MVC site.

I have been given two connection strings.. essentially adding another connection string to the one that was already in the webconfig <connectionsStrings> section.

The project uses the Entity Framework to create the database in SQLEXPRESS from the model. However, I end up with two databases - one for the security and one for Movies... further I also end up with the Security database under App_data and the other in the data directory within the SQLEXPRESS direcctories.

By the way I also added in the option of "User Instance=true" to try and force it into the local dirctory

My connection strings as given by the tutorial are:

	<connectionStrings>
		<add name="ApplicationServices"
         connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true"
         providerName="System.Data.SqlClient" />
		<add name="MovieDBContext"
     connectionString="Server=.\SQLEXPRESS;
     Database=Movies;Trusted_Connection=true"
     providerName="System.Data.SqlClient" />
	</connectionStrings>

Open in new window


I removed the second connection string all together and it still created a database called MvcMovie.Models.Movie+MovieDBContext in the SQLEXPRESS data directory.

How do I have only one database that sits within the project... what connection string will support that...

It puts the security  e.g Login/user details in another database.....

Simon
Avatar of nmarun
nmarun
Flag of India image

Are you saying you want to combine the two databases or are you saying you need the Movies database to be in the App_Data folder?

I'm guessing you're looking at the below tutorial:
http://www.asp.net/mvc/tutorials/create-a-movie-database-application-in-15-minutes-with-asp-net-mvc-cs

Thanks,
Arun
Avatar of si2030
si2030

ASKER

Hi nmarun,

Actually I was working my way through this tutorial:

http://www.asp.net/mvc/tutorials/getting-started-with-mvc3-part1-cs

Sorry for not indicating such.

What it did was to create an ASPNET database in the App_Data folder and then I had to create another database which ended up in the data directory in the SQLEXPRESS MSSQL Directory...

What I wanted to know was.. can you combine the two databases and have it reside under theApp_data folder in your project?
ASKER CERTIFIED SOLUTION
Avatar of nmarun
nmarun
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial