Microsoft Exam Questions

Which code segment should you use?

You create a Microsoft Windows Service application by using the Microsoft .NET Framework 3.5 and Microsoft ADO.NET.

The application uses a Microsoft SQL Server 2005 database named Store.
The Store database stores data in two SQL Server 2005 servers named Server1 and Server2.
You need to ensure that the application caches the data by configuring the SqlDependency object.

Which code segment should you use?

A.
SqlDependency.Start("SERVER=Server1,Server2;DATABASE=Store;");

B.
SqlDependency.Start("SERVER=Server1;SERVER=Server2;DATABASE=Store;");

C.
SqlDependency.Start("SERVER=Server1;DATABASE=Store;");
SqlDependency.Start("SERVER=Server2;DATABASE=Store;");

D.
SqlConnection conn = new SqlConnection("SERVER=Server1;DATABASE=Store;");
SqlDependency sqlDep1 = new SqlDependency(new SqlCommand("SELECT orderID FROM Server1.Store.dbo.ORDERS",conn));
SqlDependency sqlDep2 = new SqlDependency(new SqlCommand("SELECT orderID FROM Server2.Store.dbo.ORDERS",conn));