nerdexam
Microsoft

70-516 · Question #264

You have a database named DB1 that contains a table named Customers. You declare a DataSet named customersDataSet. You need to ensure that customersDataSet contains all of the records from the…

The correct answer is A. Option A. Example: To create a sample Visual C# .NET console application that demonstrates how to use the SqlCommandBuilder object to automatically generate the DeleteCommand, the InsertCommand, and the UpdateCommand properties of the SqlCommand object for a SqlDataAdapter object…

Implementing Data Access

Question

You have a database named DB1 that contains a table named Customers. You declare a DataSet named customersDataSet. You need to ensure that customersDataSet contains all of the records from the Customers table. Which code should you use?

Exhibit

70-516 question #264 exhibit

Options

  • AOption A
  • BOption B
  • COption C
  • DOption D

How the community answered

(41 responses)
  • A
    85% (35)
  • B
    10% (4)
  • C
    2% (1)
  • D
    2% (1)

Explanation

  • Example: To create a sample Visual C# .NET console application that demonstrates how to use the SqlCommandBuilder object to automatically generate the DeleteCommand, the InsertCommand, and the UpdateCommand properties of the SqlCommand object for a SqlDataAdapter object. SqlConnection cn = new SqlConnection(); DataSet CustomersDataSet = new DataSet(); SqlDataAdapter da; SqlCommandBuilder cmdBuilder; //Set the connection string of the SqlConnection object to connect //to the SQL Server database in which you created the sample cn.ConnectionString = "Server=server;Database=northwind;UID=login;PWD=password;"; //Initialize the SqlDataAdapter object by specifying a Select command //that retrieves data from the sample table. da = new SqlDataAdapter("select * from CustTest order by CustId", cn); //Initialize the SqlCommandBuilder object to automatically generate and initialize //the UpdateCommand, InsertCommand, and DeleteCommand properties of the SqlDataAdapter. cmdBuilder = new SqlCommandBuilder(da); //Populate the DataSet by running the Fill method of the SqlDataAdapter. da.Fill(CustomersDataSet, "Customers");

Topics

#DataSet#SqlDataAdapter#Fill method#database connection

Community Discussion

No community discussion yet for this question.

Full 70-516 Practice