You use Microsoft .NET Framework 4 to develop an application that connects to a Microsoft SQL
Server 2008 database. You add the following stored procedure to the database.
CREATE PROCEDURE dbo.GetClassAndStudents
AS
BEGIN
SELECT * FROM dbo.Class
SELECT * FROM dbo.Student END
You create a SqIGonnection named conn that connects to the database. You need to fill a DataSet
from the result that is returned by the stored procedure. The first result set must be added to a
DataTable named Class, and the second result set must be added to a DataTable named Student.
Which code segment should you use?
A.
DataSet ds = new DataSet();
SqlDataAdapter ad = new SqlDataAdapter
(“GetClassAndStudents”, conn);
ds.Tobies.Add(“Class”);
ds.Tables.Add(“Student”);
ad.Fill(ds);
B.
DataSet ds = new DataSet();
SqlDataAdapter ad = new SqlDataAdapter
(“GetClassAndStudents”, conn);
ad.TableMappings.Addf’Table”, “Class”);
ad.TableMappings.Add(“Tablel”, “Student”) ;
ad.Fill(ds) ;
C.
DataSet ds = new DataSet();
SqlDataAdapter ad = new SqlDataAdapter
(“GetClassAndStudents”, conn);
ad.MissingMappingAction = MissingMapplngAction.Ignore;
ad.Fill(ds, “Class”);
ad.Fill(ds, “Student”);
D.
DataSet ds = new DataSet();
SqlDataAdapter ad = new SqlDataAdapter
(“GetClassAndStudents”, conn);
ad.Fill(ds);
Explanation:
http://msdn.microsoft.com/en-us/library/ms810286.aspx
http://msdn.microsoft.com/en-us/library/ms810286.aspx