Previous Section  < Day Day Up >  Next Section

11.7. Test Your Understanding

1:

What four classes must a .NET data provider supply?

2:

Given the following code:


SqlCommand cmd = new SqlCommand();

cmd.Connection = conn;

string s = "insert into movies(movie_title, movie_year,

            bestpicture)values(&p1,&p2,&p3); "

cmd.CommandText= s;


which of the following code segments completes the SQL query string to insert the movie row?

  1. 
    string p1="Star Wars";
    
    int p2 = 1977;
    
    string p3= "N";
    
    

  2. 
    cmd.Parameters.AddWithValue ("@p1","Star Wars");
    
    cmd.Parameters.AddWithValue ("@p2", "1977");
    
    cmd.Parameters.AddWithValue ("@p3", "N");
    
    

  3. 
    cmd.Parameters.Add("@p1", SqlDbType.NVarChar, 100);
    
    cmd.Parameters.Add("@p2", SqlDbType.NVarChar, 4);
    
    cmd.Parameters.Add("@p3", SqlDbType.NVarChar, 1);
    
    p1.Value = "Star Wars";
    
    p2.Value = "1977";
    
    p3.Value = "N";
    
    

3:

Describe the purpose of these three command object methods:


ExecuteNonQuery

ExecuteReader

ExecuteScalar


4:

Compare the role of the DataReader and the DataAdapter.

5:

What is the difference between a DataSet and a DataTable?

6:

The DataRowState property maintains the status of a row. Which of these is not a valid DataRowState value?

  1. 
    Added
    
    

  2. 
    Deleted
    
    

  3. 
    Rejected
    
    

  4. 
    Changed
    
    

7:

You have an XML file and want to create a DataSet that has rows and columns that match the layout of the XML file. The XML file does not have a schema (.xsd) file associated with it. What DataSet method is used to create the DataSet schema?

    Previous Section  < Day Day Up >  Next Section