TAILIEUCHUNG - Creating and Using a DataViewManager Object

Creating and Using a DataViewManager Object To create a DataViewManager, you use one of the following constructors: DataViewManager() DataViewManager | Creating and Using a DataViewManager Object To create a DataViewManager you use one of the following constructors DataViewManager DataViewManager DataSet myDataSet where myDataSet specifies the DataSet used by the DataViewManager object. This sets the DataSet property of the new DataViewManager object to myDataSet. Let s take a look at an example of creating and using a DataViewManager. Assume you have a DataSet named myDataSet which contains a DataTable populated with rows from the Customers table. The following example creates a DataViewManager object named myDVM passing myDataSet to the constructor DataViewManager myDVM new DataViewManager myDataSet The next example sets the Sort and RowFilter properties that will be used later when a DataView for the Customers DataTable is created Customers .Sort CustomerlD Customers .RowFilter Country UK Note The previous code doesn t actually create a DataView it merely sets the properties of any DataView created in the future that views rows from the Customers DataTable. The following example actually creates a DataView by calling the CreateDataView method of the myDVM DataViewManager passing the customersDT DataTable to CreateDataView DataView customersDV customersDT The Sort and RowFilter properties of the customersDV DataView are set to CustomerlD and Country UK respectively. These are the same settings as those set earlier in the DataViewSettings property. Listing shows a complete example that creates and uses the DataViewManager shown in this section. Listing illustrates the use of a DataViewManager object using System using using class UsingDataViewManager public static void Main SqlConnection mySqlConnection new SqlConnection server localhost database Northwind uid sa pwd sa SqlCommand mySqlCommand SELECT

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