147.

You are a Web developer for your company. You create an ASP.NET application that accesses
sales and marketing data. The data is stored in a Microsoft SQL Server 2000 database on a
server named TestK01.
The company purchases a factory automation software application. The application is installed
on TestK01, where it creates a second instance of SQL Server 2000 named Factory and a
database named FactoryDB. You connect to FactoryDB by using Windows Integrated
authentication.
You want to add a page to your ASP.NET application to display inventory data from
FactoryDB. You use a SqlConnection object to connect to the database. You need to create a
connection string to FactoryDB in the instance of SQL Server named Factory on TestK01.
Which string should you use?

The Data Source attribute of the connection string contains the name, instance or
network address of the instance of SQL Server to which to connect. In this scenario we are to
connect to the Factory Instance on TestK01 so we use TestK01\Factory as data source.
To specify the database we should either use the Database or the Initial Catalog attribute. Here we
use Database=FactoryDB.
Note: The SQL Server .NET Data Provider provides connectivity to Microsoft SQL Server version
7.0 or later using the SqlConnection object. The connection string includes the source database
name, and other parameters needed to establish the initial connection.