Microsoft
70-516 · Question #183
70-516 Question #183: Real Exam Question with Answer & Explanation
Sign in or unlock 70-516 to reveal the answer and full explanation for question #183. The question stem and answer options stay visible for context.
Question
The application populates a DataSet object by using a SqlDataAdapter object. You use the 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 { 09 ... 10 } 11 } 12 dataAdpater.Update(ds); You need to remove all the records from the Categories database table that match the value of the searchValue variable. Which line of code should you insert at line 09?
Options
- AcategoryRow.Delete();
- Bds.Tables[0].Rows.RemoveAt(0);
- Cds.Tables[0].Rows.Remove(categoryRow);
- Dds.Tables[0].Rows[categoryRow.GetHashCode()].Delete();
Unlock 70-516 to see the answer
You've previewed enough free 70-516 questions. Unlock 70-516 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.