You create a Web Form that displays a GridView. The GridViews data source is a DataSet named dsOrders. The DataSet contains two DataTables named Orders and OrderDetails. You create a relation between the two DataTables using the following code segment. (Line numbers are included for reference only.)01 dtOrders = dsOrders.Tables[“Orders”]; 02 dtOrderDetails = dsOrders.Tables[“OrderDetail”]; 03 colParent = dtOrders.Columns[“OrderID”]; 04 colChild = dtOrderDetails.Columns[“ParentOrderID”]; 05 dsOrders.Relations.Add(“Rell”, colParent, colChild, false); You need to find the cause of the exception being raised in line 05. What should you do? ()
- A、Ensure that the child column and the parent column have the same names.
- B、Ensure that the child table and the parent table have the same names.
- C、Ensure that the child column and the parent column have the same data types.
- D、Ensure that each row in the child table has a corresponding row in the parent table.
- E、Ensure that the tables have an explicit relationship defined by a foreign key constraint in the database.
正确答案:C
答案解析:有
微信扫一扫手机做题