Q:
You are a Web developer for XYZ. 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 XYZ01.
The company purchases a factory automation software application. The application is installed on XYZ01, 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 XYZ01. Which string should you use?
Answer & Explanation
Answer: D) ?Data Source=XYZ01\Factory; Database=FactoryDB; Integrated Security=SSP1?
Explanation: 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 XYZ01 so we use XYZ01\Factory as data source. To specify the database we should either use the Database or the Initial Catalog attribute. Here we use Database=FactoryDB.
Incorrect Answers:
A, B: There is no Server attribute in the connection string. Instead we should use the Data Source attribute to specify the server and the instance.
C: There is no Initial Category attribute in the connection string. We can use Database or the Initial Catalog attribute to specify the database.
View Answer
Report Error
Discuss