Home

Connection to a Microsoft SQL Server

   

Working from the Server

After installing Microsoft SQL Server, you can use it. To perform an operation on a database server, you must establish a connection to it. To do this, you have to log on to the server. You have various options. If you are working directly on the server:

  • You can start Microsoft SQL Server Management Studio and a Connect To Server dialog box would come up
  • If you had clicked Cancel on the Connect To Server dialog box, to establish a connection, in the Object Explorer, you can click Connect -> Database Engine...
  • If you had already established a connection to one server but you want to create a connection to another server, in the Object Explorer, you can click Connect -> Database Engine...

The Connect To Server dialog box allows you to identify yourself (or the account you will use) to establish a connection with a server that is running Microsoft SQL Server. You must provide the necessary credentials. You can use Windows Authentication. Here is an example:

Connect to Server

Alternatively, you can use an existing SQL Server account. To do this, select SQL Server Authentication from the Authentication combo box. Enter a username in the Login combo box and enter a password in the corresponding text box:

Connect to Server: SQL Server Authentication

Once you are ready, click Connect.

Working from Microsoft Visual Studio

To be as flexible as possible, ADO.NET allows you to work with various types of databases. This also means that when you create an application, you must certainly first specify the type of database system you would be using.

If you are creating a graphical database application using Microsoft Visual Studio, you do not have to first explicitly log on to a Microsoft SQL Server. You can establish a connection from Microsoft Visual Studio. To do this, first display the Server Explorer window. To display the Server Explorer, on the main menu, you can click View -> Server Explorer.

To create a new connection, you can right-click the Data Connections node and click Add Connection...

Server Explorer: Add Connection

The Add Connection dialog box would display:

Add Connection

 

As another technique, to create a connection, on the main menu, you can click Data -> Add New Data Source... In the Data Source Configuration Wizard, click Database and click Next:

In the second page of the wizard, you can click New Connection to open the Add Connection dialog box.

   

Previous Copyright © 2007-2009 FunctionX, Inc. Next