You create an application by using the Microsoft .NET Framework 3.5 and Microsoft
ADO.NET. The application connects to a Microsoft SQL Server 2005 database. 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?
A.
categoryRow.Delete();
B.
ds.Tables[0].Rows.RemoveAt(0);
C.
ds.Tables[0].Rows.Remove(categoryRow);
D.
ds.Tables[0].Rows[categoryRow.GetHashCode()].Delete();