简体   繁体   English

将Azure数据库连接到现有的Asp.Net Web应用程序

[英]Connect Azure database to existing Asp.Net web application

I'm actually working on an university project and have to figure out how to connect my windows azure database to an already existing ASP.net web application project. 我实际上正在从事一个大学项目,并且必须弄清楚如何将Windows Azure数据库连接到已经存在的ASP.net Web应用程序项目。

The web application should run on smartphones and tablets. 该网络应用程序应在智能手机和平板电脑上运行。 Since this is a group project, we use TFVC to manage the project. 由于这是一个小组项目,因此我们使用TFVC来管理项目。

Our client supplied an mysql script that will create the tables needed. 我们的客户提供了一个mysql脚本,它将创建所需的表。 The Database is hosted in Azure and we want to access it through Visual Studio ultimate, so we can reveice data from the DB and integrate it's data in the application. 该数据库托管在Azure中,我们希望通过Visual Studio Ultimate进行访问,因此我们可以从数据库中获取数据并将其数据集成到应用程序中。

I also got the connection string, so I could use it if needed. 我还获得了连接字符串,因此可以在需要时使用它。

So my question is: How can I connect to the database through visual studio and afterwards: how can I access to it? 所以我的问题是:如何通过Visual Studio连接到数据库,之后如何访问数据库? With access I mean, how and where can I use SQL queries in Visual Studio? 我的意思是访问,在Visual Studio中如何以及在哪里使用SQL查询?

I don't really know where to start, whether it is connecting to the DB via code or on another way. 我真的不知道从哪里开始,无论是通过代码还是以其他方式连接到数据库。

Every kind of help is welcome. 欢迎各种帮助。

Thank you in advance. 先感谢您。

Your question is still quite vague on specifics of what you want to achieve but hopefully this answers it. 您的问题对于要实现的目标仍然很模糊,但是希望可以回答。 If not, please provide even more detail on your question. 如果没有,请提供有关您问题的更多详细信息。

If you just want to see the DB in Visual Studio and interact with it 如果您只想在Visual Studio中查看数据库并与之交互

  1. Download the Azure SDK 下载Azure SDK
  2. Go to Tools > Connect To Database 转到工具>连接到数据库

A side box will open and you can navigation through Azure then to your database. 将打开一个边箱,您可以在Azure中导航,然后导航到数据库。

Personally I prefer using SQL Server Management Studio, its much more responsive that the UI through Visual Studio. 我个人更喜欢使用SQL Server Management Studio,它比通过Visual Studio的UI响应更快。

If you want to connect your application to Azure, as in code an application that talks to a database, then you just need to replace the connection string in your Web.Config to your Azure Connection String. 如果要将应用程序连接到Azure(如与数据库通信的应用程序的代码所示),则只需将Web.Config中的连接字符串替换为Azure连接字符串。 Then either use ADO.NET, Entity Framework or another ORM. 然后使用ADO.NET,实体框架或其他ORM。

I recommend Entity Framework but it all depends on what your circumstances and project requirements are. 我建议使用Entity Framework,但这取决于您的情况和项目要求。

If the DB already has its schema defined get started here: https://www.asp.net/mvc/overview/getting-started/database-first-development/setting-up-database 如果数据库已经定义了其架构,请从这里开始: https : //www.asp.net/mvc/overview/getting-started/database-first-development/setting-up-database

If its empty you can use code first: http://www.asp.net/mvc/overview/getting-started/getting-started-with-ef-using-mvc/creating-an-entity-framework-data-model-for-an-asp-net-mvc-application 如果为空,则可以先使用代码: http : //www.asp.net/mvc/overview/getting-started/getting-started-with-ef-using-mvc/creating-an-entity-framework-data-model -用于-AN-ASP净MVC应用程序

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 ASP.Net Web应用程序连接到主机SQL数据库 - ASP.Net web application connect to host SQL DataBase 如何连接到ASP.NET Web应用程序中的MySql数据库? - How to connect to a MySql database in ASP.NET web application? 如何将 ASP.NET Web 应用程序部署到 Azure 与现有的 Z9778840A0104CB30C52ZB7 服务器数据库 (76410CB30C52ZB7) 服务器数据库 - How to deploy an ASP.NET Web App to Azure with an existing SQL Server database (Azure Data Studio) 将ASP.NET Web项目上的现有数据从Visual Studio中的本地数据库部署到Azure数据库 - Deploy existing data on ASP.NET web project from local database in Visual Studio to Azure database ASP.NET Web应用程序Azure设置 - ASP.NET Web Application Azure Settings 是否可以在 Visual Studio 中连接现有的本地数据库并使用 ASP.NET mvc Core 在 Web 上生成数据? - Is it possible to connect an existing local Database in Visual studio and generate the Data on Web with ASP.NET mvc Core? 将 Azure ADFS 与现有 ASP.NET Web 应用程序连接的过程和要求 - Procedure and Requirement for connecting Azure ADFS with existing ASP.NET web application 如何在现有的Azure MVC ASP.NET Web应用程序上启用“云中的主机” - How to enable “host in the cloud” on existing Azure MVC ASP.NET web application asp.net Web API无法使用非管理员用户连接到Azure SQL数据库 - asp.net web api cannot connect to Azure SQL database with non-admin user 将Web API添加到现有的asp.net Web表单应用程序 - Adding Web API to existing asp.net web forms Application
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM