How to view data on the Azure SQL database - sql

I created a default ASP.NET web form web site using Visual Studio. By default it contains a .mdf database file, Registration page, Login page and some other pages. Then I host this web application on Azure as a web app.
After that I did several registrations for the web site and I need to see the data (data which i used on registration) on the hosted application.
Is there any way to connect to the database file in Azure? In Azure, I did not set up a connection string. I just publish the app and it manages the database connection itself.

There is nothing inside the "Database" section
It seems that you do not publish your asp.net to Azure with Sql Database correctly. So, you could refer to this article to check if you have deploy database correctly.
As you have published, you could go to the database on Azure portal and choose query editor(preview). Click Login and enter the username and password you have set in Azure Sql server.
Also, you could open Microsoft SQL Server Management Studio to get your database. And you also need to login into the Sql Server as above.
After logining into the sql database, you will see all the data you have insert.
BTY, make sure you have synced the data in local database to Azure Sql Database. For more details, you could refer to this article.

Related

How to upload Visual Studio SQL server LocalDB to Azure

I just finished my first website on Visual Studio, using LocalDB with 30 tables and Identity. Then, I tried to move this website to Azure and I just got success to move the app. Unfortunately, the LocalDB is not recognized by Azure. What do I need to do to upload the database schemes and data?
You can migrate your on-premises database to Azure SQL database using SQL Server 2012(SQL Server 2017 and 2019 might face compatibility issues) and SQL Server Management Studio (SSMS).
Firstly, you need to attach your existing database with SSMS. Follow the link.
Follow the below steps in SSMS once your database attached.
Right click on the database you want to migrate. Select Task and from dropdown options select Deploy Database to Microsoft Azure SQL Database
Click on Next on pop-up window. On the very next window you will get options to connect your Azure SQL Server. Provide your Azure SQL server name, server credentials and click on Connect.
Provide the database name you want to give in Azure SQL Server. Fill the Azure SQL Database settings as per your requirement. Click on Next.
Lastly, you will get a summary of all the settings you have done. Click on Finish to migrate the database.
Once your database migrated successfully, you will get summary with Operation Complete message. Click on close. Your database has been migrated.
Check on your Azure Portal to check the migrated database.

Can't interact with database when published to azure

Below is the steps i have took to publish my Website to Azure. I have two data connections the "defaultconnection" for users tables log in register etc. The other is a connection to an Azure Sql Database.
On Azure i created a new app service.
In Visual Studio i click on project and select publish.
In the publish Web window that pops up i select Microsoft Azure Web Apps.
In the following window i select the app service i created in Azure.
In the settings window it shows the two connection database connections.
They both have the same connection string which is the Azure hosted Database. I am not sure what to change the connection string to for the users table. I created a SQL database in azure and connected that to the app service then used that connection string for the "defaultconnection". The string is below
Server=tcp:userauthen.database.windows.net,1433;Data Source=userauthen.database.windows.net;Initial Catalog=USERAUTH;Persist Security Info=False;User ID={your_username};Password={your_password};MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;
I published to azure and am able to go through the pages but as soon as i try to interact with the database i get an internal server error 500.
I tried publishing the website without userlogin so i could see if it connected to the Azure sql database but i still get the internal server error 500. I am really stuck at this point and any assistance would be helpful.
So i changed the firewall settings to allow certain IP address and it worked. I can access both my databases.

Publishing to live, changing localdb to SQL

I have created an ASP.NET MVC 3 application locally and now I'm wanting to publish it to windows azure server (which is all set up fine within my account) so that it is accessible by anyone.
However I'm having issues as the database used in the application and the connection strings in web.config are localdb.
How do I go about changing localdb to SQL database so that I can host the website live properly?
Do I just need to change the connection strings or is there further configuration required on the server or in the application?
Just change the connection string from localdb to SQL Server.

web role access sql azure in same data center

I published my web role in windows azure which is accessing a SQL azure in same data center. According to Microsoft, above model should be called "Code Near Connectivity" and the connection between web role and SQL azure will not over internet but internally. See details at page http://programming4.us/database/1078.aspx#HPXtedlpJh3o1l1H.99
I wonder the Code-Near-Connection will be auto made by windows azure or anything needed to be applied first to make it happen.
It is automatic as long as you have selected to deployment of your code and sql db in the same region.

FTP Database to webhost server

I have written an asp.net mvc application that is connected to a Microsoft SQL Server Management Studio database and I want to deploy the application to the webhosting server now. I have managed to get the published code onto the server easily. However, I want to ftp the database I created in Microsoft SQL Server Management Studio to the server. Where are these created databases saved and is it possible to ftp the database to the server. The other issue is the web hosting server is using MS SQL Server Express is that a problem?
Normally shared hosts expect you to place the database in the App_Data folder and use it directly from there.
Here is a page to explain connecting to the database
http://msdn.microsoft.com/en-us/library/ms247257.aspx
To find the database on your system open sql management studio right click the Database and click Properties on the Properties windows click on the Files section to show all associated files with your database.
I would recommend checking your providers documentaion though they might have specific requirments for database deployments