How do I connect Azure SQL to Visual Studio? - visual-studio

I’m doing a project for school that requires building a function IT project. I’ve got the HTML, CSS, and SQL parts down pat. It’s the combination in Visual Studio 19 Mac that isn’t clicking for me.
How do I go about connecting my existing SQL database to my Visual Studio project?

Check out https://learn.microsoft.com/en-us/azure/azure-sql/database/connect-query-content-reference-guide. This reference guide will point out how to obtain the connection string for your Azure SQL Database. You can use this connection string to add a connection via the SQL Server Object Explorer, (Ctrl+, Ctrl+S) in Windows, I assume it's (Cmd+, Cmd+S) on Mac, to be able to query your database from inside Visual Studio.
The Add Connection diaglog will allow you to add your IP to the Firewall which is needed to access the database/server. This principal works the same for local network databases. Make sure you choose the correct Authentication type, e.g. Azure AD for Azure SDL, Windows for local network SQL Servers if so properly configured. You can always use SQL Server Auth for either one.

Related

Advice on creating a local instance of Azure Website

I have, I admit, done things the wrong way round and created an Umbraco installation on Azure, developed multiple websites on that installation and only just decided I want a local instance for further development purposes.
Given that that's where I am, does anyone have any advice for how to go about achieving this? I have tried installing Visual Studio Community 2017 and MS SQL Server 2017 Developer and while I can connect to Azure with Visual Studio I don't seem to be able to work out how to view the installation, much less copy it down to my PC (something which I my searches seem to suggest isn't possible with Visual Studio).
I think you will need to copy down the site via FTP and the database using SQL Server Management Tools (assuming you are using SQL Server and not SQL CE).
You can get the FTP connection information from the Azure portal. The web root is in /site/wwwroot. Copy it down locally and you will be able to open it in Visual Studio as a Web Site. For the database, you can connect to the Azure SQL database with SQL Server Management Tools (you should have the connection info from when you created the database) and then right click on the database, select "Tasks" > "Export Data-tier application..." which will allow you to save a 'bacpac' file your local machine. You can then connect to your local SQL Server instance, and then right click on the "Databases" node in the Object Explorer and select "Import Data-tier application..." Once the database is imported, you may need to create/update a SQL Server user and grant it access to the database you just imported. For local development I just set the user to be owner of the the db. Back in Visual Studio, you should update the "umbracoDbDSN" connection string to use the new local database. At this point you should be able to run the website locally.

how to connect SQL Server .ndf file to visual studio 2013?

I am using SQL Server 2014 and Microsoft Visual Studio 2013 and want to connect my .ndf file with Visual Studio 2013.
Is It Possible?
It doesn't. For starters, you connect to a database that is hosted by an instance of a SQL Server engine. There is no concept of connecting directly to a data file, primary (mdf) or otherwise (ndf, ?df). You also cannot connect directly to an ndf file without the primary (mdf) file. Metadata about the database (including files and locations) along database objects are stored in the mdf so without that, you can't even start your database.

Error after restoring TFS database to new hardware

I am using TFS 2012. I wanted to test how i can recover from server failure or any hardware failure, So i wanted to shift TFS to new PC.
I followed some articles to restore it. what i did is
1)I had full backup of TFS_configuration and all other collection database.(backup taken using TFSbackup.exe)
2)In new PC i installed all the softwares(such as TFS 2012, sql server etc).
3)created all the windows user account as in old server.
4)When I checked the New PC it had default collection created which was mapped to sql server which i installed.
5)Now i deleted that default collection and restored all databases of my old TFS server(TFS_configuration and all other collection database.)(backup restored using TFSrestore.exe)
6)Now when i checked TFS administrative console it had all the collections as my old server.
7) But when i click on Administrative security, group membership etc I get error like
TF30046: The instance information does not match. Team Foundation expected 368f7830-1c67-4c4c-8bc4-ba3d5b5a5543 which was not found. Please contact your Team Foundation Server administrator.
In this link it was mentioned to change service host id in table. But it didn't work for me.
So please help
You mistakenly configured TFS (in fact it created a default collection). If read carefully Move Team Foundation Server from one hardware configuration to another, you have to run the AT-only Configuration Wizard after restoring the databases.

Install sql server express database engine only

I am deploying a wpf application that requires sql server 2008 as a prerequisite. As a result I am embedding the sql server installer in my application. When that launches the SQL Server Installation window shows up:
I don't want the user to have to go through out this installation. That program will install SQL Express and many other things like SQL Management Studio.
Is there a place where I can download SQL Express 2008 the database engine only? so that the user will just have to click next, Agree, Ok... etc... without having to make complicated decisions. Or maybe is it possible to install sql server express throughout the command line?
I am including the installer in my application because my application is supposed to be able to be installed without having an interenet connection. Also I cannto seem to find a place where I can download SQL Server express the database engine only.
Go here and download the appropriate version of SQL Express. Then see the How to: Install SQL Server 2008 R2 Using a Configuration File article on MSDN. Note that after you generate the config file for the installation, changing the following keys in the config will probably be of particular interest to you:
; Setup will not display any user interface.
QUIET="False"
; Setup will display progress only without any user interaction.
QUIETSIMPLE="True"
; Automatically accept the license terms
IAcceptSQLServerLicenseTerms="True"

Visual Studio 2010 cannot add reference because it cannot connect to SQL server

I'm pretty new to Visual Studio so this might be an easy issue :)
I have created a Visual C# SQL CLR Database project where I have created a Trigger. This trigger is supposed to access an IIS on another machine in the network. In order to do this I found that I needed System.DirectoryServices but when I added this VS complained that I needed an assembly. Then I found that I should run the CREATE ASSEMBLY in the MS SQL SERVER. Did that successfully and successfully added my database as a data connection (Server Explorer -> Data Connections). In the Assemblies subfolder I can see the System.DirectoryServices but cannot reference it from the add reference... (when right-clicking references in the solution explorer). When trying to add a reference I have two tabs: Projects (empty) and SQL Server which gives the following error:
The connection to the database failed for the following reason: There
is no available SQL server connection.
No server references can be added at this time, but you may continue
to develop the project.
When I try to add a server connection to either localhost or the machine name of my computer it seems to do nothing (no error but also no server is added in the server explorer).
In Solution Explorer, right click on the Project and select 'Properties'. Select 'Database' tab on the right hand side, then browse to your database or insert a connection string.

Resources