Accessing-Data-with-Microsoft-NET-Framework-(70-516-VB).pdf...

This preview shows page 1 - 4 out of 9 pages.

70-516-VBMicrosoftAccessing Data with Microsoft .NET Framework
QUESTION:134The application populates a DataSet object by using a SqlDataAdapter object. You usethe DataSet object to update the Categories database table in the database.You write the following code segment. (Line numbers are included for reference only.)01 SqlDataAdapter dataAdpater = new SqlDataAdapter("SELECT CategoryID,CategoryName FROM Categories", connection);02 SqlCommandBuilder builder = new SqlCommandBuilder(dataAdpater);03 DataSet ds = new DataSet();04 dataAdpater.Fill(ds);05 foreach (DataRow categoryRow in ds.Tables[0].Rows)06 {07 if (string.Compare(categoryRow["CategoryName"].ToString(), searchValue,true) == 0)08 {0910 }11 }12 dataAdpater.Update(ds);You need to remove all the records from the Categories database table that match thevalue of the searchValue variable. Which line of code should you insert at line 09?A
QUESTION:135You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create anapplication. The application connects to two different Microsoft SQL Server 2008database servers named Server1 and Server2. A string named sql1 contains a connectionstring to Server1. A string named sql2 contains a connection string to Server2.01 using (TransactionScope scope = new0203 )04 {05 using (SqlConnection cn1 = new SqlConnection(sql1))06 {07 try{9208
09 }10 catch (Exception ex)11 {12 }13 }14 scope.Complete();15 }You need to ensure that the application meets the following requirements: There is aSqlConnection named cn2 that uses sql2. The commands that use cn1 are initiallyenlisted as a lightweight transaction. The cn2 SqlConnection is enlisted in the sameTransactionScope only if commands executed by cn1 do not throw an exception. Whatshould you do?A.InsertthefollowingcodesegmentatlineTransactionScope(TransactionScopeOption.Suppress) Insert the following code segmentat line 08.02.

Upload your study docs or become a

Course Hero member to access this document

Upload your study docs or become a

Course Hero member to access this document

End of preview. Want to read all 9 pages?

Upload your study docs or become a

Course Hero member to access this document

Term
Fall
Professor
Mohammad Alizadeh
Tags
NET Framework, Microsoft SQL Server, Microsoft Visual Studio

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture