11.7. Test Your Understanding

 < Day Day Up > 


What four classes must a .NET data provider supply?


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"; 


Describe the purpose of these three command object methods:

 ExecuteNonQuery ExecuteReader ExecuteScalar 


Compare the role of the DataReader and the DataAdapter.


What is the difference between a DataSet and a DataTable?


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 


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?

     < Day Day Up > 

    Core C# and  .NET
    Core C# and .NET
    ISBN: 131472275
    EAN: N/A
    Year: 2005
    Pages: 219

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net