zl程序教程

您现在的位置是:首页 >  后端

当前栏目

Add a connection in Server Explorer

server in add Connection Explorer
2023-09-11 14:14:17 时间

Add new connections

The steps in this article show how to connect to a database in the Visual Studio IDE. You can use these steps to work directly with your data, such as execute queries, edit data, create and edit tables and other schema properties, edit stored procedures and functions, triggers, and so on. These functions are independent of the programming language or .NET version you are using.

You can test your connection to a database or service, and explore database contents and schemas, by using Server Explorer or SQL Server Object Explorer. The functionality of these windows overlaps to some extent. The basic differences are:

  • Server Explorer

    Installed by default in Visual Studio. Can be used to test connections and view SQL Server databases, any other databases that have an ADO.NET provider installed, and some Azure services. Also shows low-level objects such as system performance counters, event logs, and message queues. If a data source has no ADO.NET provider, it won't show up here, but you can still use it from Visual Studio by connecting programmatically.

  • SQL Server Object Explorer

    Installed with SQL Server Data Tools and visible under the View menu. If you don't see it there, go to Programs and Features in Control Panel, find Visual Studio, and then select Change to re-run the installer after selecting the check box for SQL Server Data Tools. Use SQL Server Object Explorer to view SQL databases (if they have an ADO.NET provider), create new databases, modify schemas, create stored procedures, retrieve connection strings, view the data, and more. SQL databases that have no ADO.NET provider installed won't show up here, but you can still connect to them programmatically.

Add a connection in Server Explorer

To create a connection to the database, click the Add Connection icon in Server Explorer, or right-click in Server Explorer on the Data Connections node and select Add Connection. From here, you can also connect to a database on another server, a SharePoint service, or an Azure service.

 

Connect using SQL Server Object Explorer

The experience might be easier if you use SQL Server Object Explorer, which gives you a dialog that provides more help in finding available databases locally, on the local network, and in your Azure subscriptions, and provides a history of recently used choices.

To access the connect dialog from SQL Server Object Explorer, click the toolbar button Add SQL Server.