tailieunhanh - Using XPath to Query Data in a DataSet

[ Team LiB ] Recipe Using XPath to Query Data in a DataSet Problem You need to use an XPath expression to extract certain rows from a DataSet. Solution Use SelectSingleNode( ) or SelectNodes( ). The sample code contains two event handlers: Form. | Team LiB Recipe Using XPath to Query Data in a DataSet Problem You need to use an XPath expression to extract certain rows from a DataSet. Solution Use SelectSingleNode or SelectNodes . The sample code contains two event handlers Sets up the sample by creating a DataSet containing the Orders table and Order Details table from Northwind and a nested relation between the two tables. Go Executes an XPath query to retrieve the Orders and Order Details data for an OrderlD specified by the user to an XmlNode. The results are displayed by iterating over the XmlNode to retrieve the Orders and the XmlNodeList containing the Order Details. The C code is shown in Example 8-9. Example 8-9. File Namespaces variables and constants using System using using using using using using Table name constants private const String ORDERS_TABLE Orders private const String ORDERDETAILS_TABLE OrderDetails Relation name constants private const String ORDERS_ORDERDETAILS_RELATION Orders_OrderDetails_Relation Field name constants private const String ORDERID_FIELD OrderlD private DataSet ds . . . private void XPathQueryForm_Load object sender e ds new DataSet Orders_OrderDetails SqlDataAdapter da Fill the Order table and add it to the DataSet. da new SqlDataAdapter SELECT FROM Orders S ql_ConnectString DataTable orderTable new DataTable ORDERS_TABLE orderTable orderTable Fill the OrderDetails table and add it to the DataSet. da new SqlDataAdapter SELECT FROM Order Details S ql_ConnectString DataTable orderDetailTable new DataTable ORDERDETAILS_TABLE orderDetailTable orderDetailTable Create a relation between the tables. ORDERS_ORDERDETAILS_RELATION ORDERS_TABLE .Columns ORDERID_FIELD .

crossorigin="anonymous">
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.