|
|
| Home >> Microsoft Certification >> MCSD >> Questions/Answers on Exam 070-305 >> QA1 |
Question:
You are a web developer and you have created an ASP.NET application which has its database in Microsoft SQL server 2000 on a server named SQL1.
Now you have created another instance of SQL server 2000 on SQL1 with a name Factory and database name FactoryDB. You connect to FactoryDB by using windows integrated authentication. Now you create a page in your ASP.NET application to display the data from FactoryDB. You use a SqlConnection object to connect to the database. You need to create the connection string to FactoryDB in the instance of SQL server named Factory on SQL1, which string should you use?
A. “Server= SQL1;Data Source=Factory; Initial Catalog=FactoryDB;Integrated Security=SSPI”
B. “Data Source= SQL1 \Factory;Database=FactoryDB; Integrated Security=SSP1”
C. “Data Source= SQL1 \Factory;Initial Category=Factory; Integrated Security=SSP1”
D. “Server= SQL1;Data Source=Factory; Database=FactoryDB;Integrated Security=SSP1”
Correct Answer:
B
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, For example we use SQL1\Factory. To specify the database we should either use the Database or the Initial Catalog attribute. Here we use Database=FactoryDB
Incorrect answers:
A, D: We can user either the Server attribute or the Data Source property, but not both.
C: There is no Initial Category attribute in the connection string. We can use Database or the Initial Catalog attribute to specify the database.
|
| Sponsored Links: |
|
|
| << back |
|
|
|