Đang chuẩn bị liên kết để tải về tài liệu:
Creating and Using a DataView Object

Không đóng trình duyệt đến khi xuất hiện nút TẢI XUỐNG

Creating and Using a DataView Object In this section, you'll learn how to filter and sort rows with a DataView object. You create a DataView object using one of the following constructors | Creating and Using a DataView Object In this section you ll learn how to filter and sort rows with a DataView object. You create a DataView object using one of the following constructors DataView DataView DataTable myDataTable DataView DataTable myDataTable string filterExpression string sortExpression DataViewRowState rowState where myDataTable specifies the DataTable that your DataView is associated with. Your DataView will read the rows from this DataTable. The Table property of your DataView is set to myDataTable. filterExpression specifies a string containing the expression you want to filter the rows by. The RowFilter property of your DataView is set to filterExpression. sortExpression specifies a string containing the expression you want to sort the rows by. The Sort property of your DataView is set to sortExpression. rowState specifies an additional filter to apply to the rows rowState filters by the DataRowView-State of the DataViewRow objects in your DataView. The RowStateFilter of your DataView is set to rowState. Before you create a DataView you first need a DataTable from which to read rows. The following example creates and populates a DataTable named customersDT that contains rows from the Customers table SqlCommand mySqlCommand mySqlConnection.CreateCommand mySqlCommand.CommandText SELECT CustomerlD CompanyName Country FROM Customers SqlDataAdapter mySqlDataAdapter new SqlDataAdapter mySqlDataAdapter.SelectCommand mySqlCommand DataSet myDataSet new DataSet mySqlConnection.Open mySqlDataAdapter.Fill myDataSet Customers mySqlConnection.Close DataTable customersDT myDataSet.Tables Customers Let s say you want to filter the rows in CustomersDT to view just the customers in the UK. Your filter string expression would be string filterExpression Country UK Note Notice that UK is placed within single quotes. This is because UK is a string literal. Also let s say you want to sort those rows by ascending CustomerID column values and descending CompanyName .

Đã 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.