Tương tự như vậy, các nhà cung cấp dịch vụ truy cập dữ liệu Oracle Oracle trực tiếp. Lưu ý Tất cả các nhà cung cấp lớn DBMS hỗ trợ các nhà cung cấp dữ liệu của của họ. Chúng tôi sẽ dính vào SQL Server này cuốn sách, nhưng các loại tương tự của VB NET code. viết của nhà cung cấp. | Simpo PDF Merge and Split Unregistered Version - http CHAPTER 13 USING DATASETS AND DATA ADAPTERS 235 3. Make FilterSort the startup project and run it by pressing Ctrl F5. You should see the results in Figure 13-4. Figure 13-4. Filtering and sorting a data table How It Works You code and combine two queries for execution on the same connection query 1 Dim sqll As String select from customers query 2 Dim sql2 As String select from products _ where unitprice 10 combine queries Dim sql As String sql1 sql2 create connection Dim conn As SqlConnection New SqlConnection connstring You create a data adapter assigning to its SelectCommand property a command that encapsulates the query and connection for internal use by the data adapter s Fill method create data adapter Dim da As SqlDataAdapter New SqlDataAdapter New SqlCommand sql conn You then create and fill a dataset create and fill dataset Dim ds As DataSet New DataSet ds customers Simpo PDF Merge and Split Unregistered Version - http 236 CHAPTER 13 USING DATASETS AND DATA ADAPTERS Each query returns a separate result set and each result set is stored in a separate data table in the order in which the queries were specified . The first table is explicitly named customers the second is given the default name customers1. You get the data table collection from the dataset Tables property for ease of reference later get the data tables collection DataTableCollection dtc As part of displaying the first data table you declare two strings set display filter string fl country Germany set sort string srt companyname asc The first string is a filter expression that specifies row selection criteria. It s syntactically the same as a SQL WHERE clause predicate. You want only rows where the Country column equals Germany . The second string specifies your sort criteria and is syntactically the same as a SQL ORDER BY clause giving a data column name and sort .