I am working on a website in ASP.NET MVC3 and following the MVC Music Store tutorial to do so, but editing things for what I need. I am now trying to get a preview of the site on my test deploy server but have trouble with the SQL connections.
I altered the SampleData file to fit my needs and replaced DropCreateDatabaseIfModelChanges<MyProjectEntities>
with DropCreateDatabaseAlways<MyProjectEntities>
because it did not update the sample data when I needed it.
When I try to look up something in the database I get the exception Cannot drop the database 'MyDatabase', because it does not exist or you do not have permission
. I understand that this is because I simply cannot drop the database, and I will not be able to do this on my server. So how can I tell the ORM that I don't want it to drop the database to create the tables but rather empty or update an existing database?
Update:
I downloaded SQL Server Management Studio and managed to get the data from the local database to the online database but now I get a different error: Login failed for user '[username]'.
I double checked the connection string and it is correct, here is the full snippet of code from my Web.config:
<add name="AdzTowerEntities"
connectionString="Data Source=xxxxx.db.xxxxxxx.hostedresource.com; Initial Catalog=xxxxxroot; User ID=xxxxxroot; Password=xxxxxpassword;"
providerName="System.Data.SqlClient"/>