1.
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 qry = "Select UserNo, UserName from dbo.USERS; select Name, Age from dbo.USER_DATA"; SqlCommand command = new SqlCommand(qry, connection); SqlDataReader reader = command.ExecuteReader(); You want to make sure that the application reads all the rows returned by the code segment. What should you do?
2.
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 sql = "Select InvoiceNo, OrderAmount from Orders"; SqlDataAdapter adp = new SqlDataAdapter(sql, con); DataTable tblOrders = new DataTable(); adp.Fill(tblOrders); You want the following: If the value of the OrderAmount column is greater than 1500, then a discount of 6 percent is calculated. Furthermore, you need to create a DataColumn object named Discount that contains the discount value for each row in the tblOrders DataTable. What should you do?
3.
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 makes uses of the following stored procedure. CREATE PROCEDURE [dbo].[UpdShipping] @Port NVarchar(10), @NewRate int AS BEGIN Update dbo.Shipping SET Rate = @NewRate Where Port = @Port RETURN @@ROWCOUNT END Your application contains the following code. (Line numbers are for reference only.) 01 using (SqlConnection connection = new SqlConnection(connectionString)) 02 { 03 connection.Open(); 04 SqlCommand command = new SqlCommand("UpdShipping", connection); 05 06 command.ExecuteNonQuery(); 07 } You want to make sure that the application can update the Shipping table. What should you do?
4.
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 application uses the Microsoft OLE DB Provider as the data provider for Oracle. The application throws an error when you try to retrieve the Oracle BLOB data. You need to make sure that the Oracle BLOB data can be retrieved. What should you do?
5.
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. (Line numbers are for reference only.) 01 using (SqlConnection connection = new SqlConnection(connectionString)) { 02 SqlCommand cmd = new SqlCommand(queryString, connection); 03 connection.Open(); 04 05 while (sdrdr.Read()){ 06 //use the data in the reader 07 } 08 } You need to make sure that the memory is used efficiently when retrieving BLOBs from the database. What should you do?
6.
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 separate the security-related exceptions from the other exceptions for database operations at run time. What should you do?
7.
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 are in the process of implement the exception-handling strategy for the application. You need to find the SQL Server 2005 exceptions that have a severity level value greater than 19. What should you do?
8.
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 Microsoft OLE DB Provider as the data provider. You have changed the data provider to Microsoft SqlClient. Lately now, the application throws errors while executing parameterized queries. What should you do?
9.
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 a SqlConnection object that is active for the lifetime of a user session. You want to make sure that the application handles all the exceptions that cannot be recovered. What should you do?
10.
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 analyzes large amounts of transaction data. These data are store in a different database. Your application contains the following code. (Line numbers are for reference only.) 01 using (SqlConnection connection = new SqlConnection(sourceConnectionString)) 02 using (SqlConnection connection2 = new SqlConnection(destinationConnectionString)) 03 using (SqlCommand command = new SqlCommand()) 04 { 05 connection.Open(); 06 connection2.Open(); 07 using (SqlDataReader reader = command.ExecuteReader()) 08 { 09 using (SqlBulkCopy bulkCopy = new SqlBulkCopy(connection2)) 10 { 11 12 } 13 } 14 } You want to copy the transaction data to the database of the application. What should you do?