1

Create an ASP.NET MVC app with auth and SQL DB and deploy to Azure App Service

above is a link to a tutorial that I followed to create a database and manipulate seeded data with a MVC app.

I am currently learning about ASP.NET & Azure in my internship. How would I go about connecting to an existing database to run CRUD operations on a table that already has data in it? How would the data already in the table show up on the page?

2
  • Can you explain your problem a bit more clear? Where do you need help? Commented Jun 8, 2015 at 9:28
  • @brothers28 I would like to know how to connect to an existing database and alter the data in it using the MVC app in the link. Also, In the link, the data from the table is shown on the app. I would like to know if already existing data would be able to show up on the app as well, vs seeding the data into the table like in the tutorial. Commented Jun 8, 2015 at 9:34

2 Answers 2

2

Take a look at your web.config file. You'll find a section:

<connectionString>
   <add key="DefaultDB" value="....."/>
</connectionString>

Just change it to your existing database. Another option, you can change the connection string when you'll publish the application:

https://acomdpsstorage.blob.core.windows.net/dpsmedia-prod/azure.microsoft.com/en-us/documentation/articles/web-sites-dotnet-deploy-aspnet-mvc-app-membership-oauth-sql-database/20150514052253/rrc2.png

If you followed the steps on the previous link you've post, just skip the step:

https://acomdpsstorage.blob.core.windows.net/dpsmedia-prod/azure.microsoft.com/en-us/documentation/articles/web-sites-dotnet-deploy-aspnet-mvc-app-membership-oauth-sql-database/20150514052253/newdb.png

Since you'll already have a database server, you won't need to create a new one.

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

Comments

0

If you are trying to use an existing DB when publishing then you can Right Click the web project in the solution explorer node and select Publish. Then you can create a publish profile to your remote site. On the settings tab you should see an entry for the connection string. In that dialog you can place a new connection string that should be used when you publish your application.

Comments

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.