[ Pobierz całość w formacie PDF ]

Leading the way in IT testing and certification tools, www.testking.com
- 85 -
070 - 316
Answer: C
Explanation: If there is a record available the Read Method advances the DataReader to next record and
returns true. If no records are available it returns false. The while loop adds one list item for each record.
Finally we must close the DateReader with the Close method.
Reference: 70-306/70-316 Training kit, Simple Data Access with the DataReader, Pages 265-266
70-306/70-316 Training kit, Using Multiple Result Sets, Pages 268-269
Incorrect Answers
A, D: The NextResult method is used to retrieve the next result set. This is used when the Command object
contains multiple SQL statements. NextResult executes the next SQL Statement in the Command object.
A multiple result set is not used to populate a list box.
B: We must always close the DateReader when we are finished with it.
QUESTION NO: 102
You develop a Windows-based application to manage inventory for TestKing inc. The application
calls a Microsoft SQL Server stored procedure named sp_UpdatePrices.
sp_UpdateTKPrices performs a SQL UPDATE statement that increases prices for selected items in an
inventory table. It returns an output parameter named @totalprice and a result set that contains all of
the records that were updated. @totalprice contains the sum of the prices of all items that were
updated.
You implement a SqlCommand object that executes sp_UpdateTKPrices and returns the results to a
SqlDataReader object. The SqlDataReader object gives you access to the data in the result set. Which
is displayed in a list box on your Windows Form.
The value of @totalprice must also be displayed in a text box on your Windows Form. You need to
write code that will retrieve this value.
Which code segment should you use?
A. while (reader.Read() {
TextBox1.Text =
com.Parameters[ @totalprice ].Value.ToString();
}
reader.Close();
B. do {
TextBox1.Text =
com.Parameters[ @totalprice ].Value.ToString();
}
while (reader.Read());
reader.Close();
C. TextBox1.Text =
Leading the way in IT testing and certification tools, www.testking.com
- 86 -
070 - 316
com.Parameters[ @totalprice ].Value.ToString();
reader.Close();
D. reader.Close();
TextBox1.Text =
com.Parameters[ @totalprice ].Value.ToString();
Answer: C
Explanation: First we retrieve the output parameter from the Dataset. Then we close the SQLDataReader.
Reference: 70-306/70-316 Training kit, Executing Commands, Parameters, Page 260-262
Incorrect Answers
A, B: We only have to retrieve the parameter once, not for each record in the result set. We should not use
a while loop.
D: We must retrieve the output parameter before we close the SQLDataReader.
QUESTION NO: 103
You develop a Windows-based application named TestKingPayroll. Your application receives
information in the form of an XML data file named dataFile. This file does not include any schema
information. You need to write code to load the XML data into a DataSet object.
Which code segment should you use?
A. DataSet ds = new DataSet( TKPayrollData );
ds.ReadXml(dataFile,
XmlReadMode.IgnoreSchema);
B. DataSet ds = new DataSet( TKPayrollData );
ds.ReadXml(datafile,
XmlReadMode.InferSchema);
C. DataSet ds = new DataSet( TKPayrollData );
ds.ReadXml(dataFile,
XmlReadMode.ReadSchema);
D. DataSet ds = new DataSet( TKPayrollData );
ds.ReadXml(dataFile,
XmlReadMode.Fragment);
Answer: B
Explanation: The InferSchema XMLReadMode ignores any inline schema, infers schema from the data and
loads the data.
Reference: .NET Framework Class Library, XmlReadMode Enumeration [C#]
Incorrect Answers
Leading the way in IT testing and certification tools, www.testking.com
- 87 -
070 - 316
A: The IgnorSchema XMLReadMode ignores any inline schema and reads data into the existing DataSet
schema. However, there exists to schema in this scenario.
C: The ReadSchema XMLReadMode reads any inline schema and loads the data.
D: The IgnorSchema XMLReadMode reads XML documents against an instance of SQL Server, but we are
reading data from a file.
QUESTION NO: 104
You develop a Windows-based application to manage business contacts. The application retrieves a
list of contacts from a central database. The list is managed locally in a DataSet object named
listDataSet, and it is displayed in a DataGrid control.
You create a procedure that will conduct a search after you enter a combination of personal name and
family name. You application currently includes the following code segment:
DataView dv = new DataView();
int i;
dv.Table = listDataSet.Tables(0);
dv.Sort =  FamilyName, PersonalName ;
DataGrid1.DataSource = dv;
You need to search for a conduct whose personal name is Tess and whose family name is King. Which
code segment should you use?
A. object[] values = { King ,  Tess };
i = dv.Find(values);
DataGrid1.CurrentRowIndex = i;
B. object() values = { King, Tess };
i = dv.Find(values);
DataGrid1.CurrentRowIndex = i;
C. object[] values = { Tess ,  King };
i = dv.Find(values);
DataGrid1.CurrentRowIndex = i;
D. object[] values = { Tess, King };
i = dv.Find(values);
DataGrid1.CurrentRowIndex = i;
Answer: A
Explanation: We load the search parameters into an array. We use two separate values. The first value is
the FamilyName and the second is PersonalName as it is used in the sort command:
dv.Sort =  FamilyName, PersonalName
The family name is King. The personal name is Tess.
Reference: 70-306/70-316 Training kit, Filtering and Sorting in a DataSet, Page 306
Incorrect Answers
Leading the way in IT testing and certification tools, www.testking.com
- 88 -
070 - 316
B, D: There are two columns. We must separate the Family name and the Personal into two separate
strings.
C: Wrong order of the search parameters. The family name King must be the first search parameter. [ Pobierz całość w formacie PDF ]

  • zanotowane.pl
  • doc.pisz.pl
  • pdf.pisz.pl
  • mew.pev.pl