You work as an application developer at Contoso.com. You use Microsoft .NET Framework 3.5 and Microsoft
ADO.NET to develop an application. The Contoso.com network contains a Microsoft SQL Server 2005 server named DB01. Your application retrieve records from a database named Trades that resides on DB01. The
application connects to Trades by using an instance of the SqlConnection class with the following connection string.
"Data Source=DB01;UID='mhamm';PWD='password';"
When the application calls the Open method of the SqlConnection object, it displays the following: "Cannot open user default database. Login failed. Login failed for user 'mhamm'".
You need to make sure that you can connect to Trades when the user account for the connection is mhamm.
What should you do?
You work as an application developer at Contoso.com. You use Microsoft .NET Framework 3.5 and Microsoft ADO.NET to develop an application that will connect to the Microsoft SQL Server 2005 database. The application is used under a Least-Privilege User Account (LUA) of the operating system. You want to configure the SQL Server 2005 connection string in the app.config file to use SQL Server Express user instances.
What should you do?
You work as an application developer at Contoso.com. You use Microsoft .NET Framework 3.5 and Microsoft
ADO.NET to develop an application that will connect to the Microsoft SQL Server 2005 database. Your
application contains the following code.
string queryString = "Select * from dbo.Users";
SqlCommand command = new SqlCommand(queryString, (SqlConnection)connection));
You want to get the value that is contained in the first column of the first row of the result set returned by the query.
You work as an application developer at Contoso.com. You use Microsoft .NET Framework 3.5 and Microsoft
ADO.NET to develop an application that will connect to the Microsoft SQL Server 2005 database. Your application contains the following code.
01 DataTable dt = new DataTable();
02 dt.Columns.Add("number");
03 dt.Columns.Add("string");
04 dt.Rows.Add(1, "3");
05 dt.Rows.Add(2, "2");
06 dt.Rows.Add(3, "1");
07 var result = from p in dt.AsEnumerable()
08
09 foreach (var number in result) {
10 Console.Write(number.ToString());
11 }
You need to display the string "321". What should you do?
You work as an application developer at Contoso.com. You use Microsoft .NET Framework 3.5 and Microsoft
ADO.NET to develop an application that will connect to the Microsoft SQL Server 2005 database. The application fills a DataSet object named cust with customer records. Your application contains the following
code. (Line numbers are for reference only.)
01 System.IO.StreamWriter sw =
02 new System.IO.StreamWriter("Customers.xml");
04 sw.Close();
You want to write the content of the cust object to the Customers.xml file as XML data along with inline XML schema. What should you do?
You work as an application developer at Contoso.com. You use Microsoft .NET Framework 3.5 and Microsoft
ADO.NET to develop an application that will connect to the Microsoft SQL Server 2005 database. The application uses an XML file that contains product data. Furthermore, a corresponding XSD file contains the
schema of the XML file. You want the application to do the following: Loads the XML file in a typed DataSet and validates it against the schema provided in the XSD file.
What should you do?
You work as an application developer at Contoso.com. You use Microsoft .NET Framework 3.5 and Microsoft
ADO.NET to develop an application that will connect to the Microsoft SQL Server 2005 database. You have completed the following code segment. (Line numbers are for reference only.)
01 public IDataReader GetCustomerReader()
02 {
03 SqlConnection con = new SqlConnection();
04 //Set up the connection
05 con.Open();
06 string sql = "Select * from Customers";
07 IDataReader rd = null;
08
09 con.Close();
10 return rd;
11 }
You need to make sure that a DataReader stream for the data in the Customers table can be returned from the GetCustomerReader method.
What should you do?
You work as an application developer at Contoso.com. You use Microsoft .NET Framework 3.5 and Microsoft ADO.NET to develop an application.
You want to make sure that the application is operative to any type of database.
What should you do?
You work as an application developer at Contoso.com. You use Microsoft .NET Framework 3.5 and Microsoft ADO.NET to develop an application that will connect to the Microsoft SQL Server 2005 database. You want to use Windows Authentication along with the Microsoft OLE DB provider. You now need to make sure that the OLE DB connection is as secure as possible.
What should you do?
You work as an application developer at Contoso.com. You use Microsoft .NET Framework 3.5 and Microsoft ADO.NET to develop an application that will connect to the Microsoft SQL Server 2005 database. The
application caches refer to tables by using a Local Database Cache class. You have completed the following code segment. (Line numbers are for reference only.)
01 public partial class LocalDataCacheProvider
02 {
03 private void InitializeConnection(string connectionString)
04 {
05 this.Connection = new System.Data.SqlClient.SqlConnection(connectionString);
06 }
07 private void InitializeNewAnchorCommand()
08 {
09
10 }
11 }
You want to make sure that the LocalDataCacheProvider class handles all database communication.
What should you do?