简体   繁体   中英

Using MVC App to run CRUD operations on Existing Azure Database

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?

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM