PrepAway - Latest Free Exam Questions & Answers

Which code segment should you insert at line 03 to fill the Order table with the next set of 5 records for eac

You create an application by using the Microsoft .NET Framework 3.5 and Microsoft ADO.NET.

The application contains a DataSet object named orderDS. The object contains a table named Order as shown in the following exhibit.

The application uses a SqlDataAdapter object named daOrder to populate the Order table.
You write the following code segment. (Line numbers are included for reference only.)

01 private void FillOrderTable(int pageIndex) {
02 int pageSize = 5;
03
04 }

You need to fill the Order table with the next set of 5 records for each increase in the pageIndex value.

Which code segment should you insert at line 03?

PrepAway - Latest Free Exam Questions & Answers

A.
string sql = “SELECT SalesOrderID, CustomerID, OrderDate FROM Sales.SalesOrderHeader”;
daOrder.SelectCommand.CommandText = sql;
daOrder.Fill(orderDS, pageIndex, pageSize, “Order”);

B.
int startRecord = (pageIndex – 1) * pageSize;
string sql = “SELECT SalesOrderID, CustomerID, OrderDate FROM Sales.SalesOrderHeader”;
daOrder.SelectCommand.CommandText = sql;
daOrder.Fill(orderDS, startRecord, pageSize, “Order”);

C.
string sql = string.Format(“SELECT TOP {0} SalesOrderID, customerID, orderDate FROM Sales.SalesOrderHeader WHERE SalesOrderID > {1}”, pageSize, pageIndex);
daOrder.SelectCommand.CommandText = sql;
daOrder.Fill(orderDS, “Order”);

D.
int startRecord = (pageIndex – 1) * pageSize;
string sql = string.Format(“SELECT TOP {0} SalesOrderID, CustomerID, orderDate FROM Sales.SalesOrderHeader WHERE SalesOrderID > {1}”, pageSize, startRecord);
daOrder.SelectCommand.CommandText = sql;
daOrder.Fill(orderDS, “Order”);

14 Comments on “Which code segment should you insert at line 03 to fill the Order table with the next set of 5 records for eac

  1. Hey! This is kind of off topic but I need some advice from an established blog.

    Is it difficult to set up your own blog? I’m not very techincal but I can figure things
    out pretty fast. I’m thinking about making my own but I’m not sure where to begin.
    Do you have any ideas or suggestions? Thank you




    0



    0
  2. nohup says:

    SqlDataAdapter is a part of the ADO.NET Data Provider and it resides in the System.Data.SqlClient namespace. SqlDataAdapter provides the communication between the Dataset and the SQL database. SqlDataAdapter Object can be used in combination with Dataset Object.

    The SqlDataAdapter Object and DataSet objects are combine to perform both data access and data manipulation operations in the SQL Server Database. When the user perform the SQL operations like Select , Insert etc. in the data containing in the Dataset Object , it won’t directly affect the Database, until the user invoke the Update method in the SqlDataAdapter.




    0



    0
  3. nohup says:

    Parameters
    dataSet
    Type: System.Data.DataSet
    A DataSet to fill with records and, if necessary, schema.
    startRecord
    Type: System.Int32
    The zero-based record number to start with.
    maxRecords
    Type: System.Int32
    The maximum number of records to retrieve.
    srcTable
    Type: System.String
    The name of the source table to use for table mapping.




    0



    0

Leave a Reply