tailieunhanh - Creating a DataView Using Visual Studio .NET

Creating a DataView Using Visual Studio .NET In this section, you'll learn how to create a DataView using Visual Studio .NET (VS .NET) | Creating a DataView Using Visual Studio .NET In this section you ll learn how to create a DataView using Visual Studio .NET VS .NET . You can follow along with the steps described in this section 1. Open VS .NET and create a new Windows application named myDataView. 2. Display Server Explorer connect to your Northwind database and drag the Customers table to your form. This creates a SqlConnection object named sqlConnectionl and a SqlDataAdapter object named sqlDataAdapterl. These objects are placed in the tray beneath your form. 3. Alter the ConnectionString property of sqlConnectionl to connect to your Northwind database. Remember to add a substring containing the password pwd sa or similar . 4. Click on the sqlDataAdapterl object in your form and then click the Generate Dataset link at the bottom of the Properties window for sqlDataAdapterl. Accept the defaults in the dialog box and click the OK button to create a DataSet object named dataSetll. 5. Drag a DataView object from the Data tab of the Toolbox to your form. This creates a DataView object named dataViewl. 6. Set the Table property of your dataViewl object to using the drop-down list to the right of the Table property set the RowFilter property to Country UK and set the Sort property to CustomerlD. See Figure . Figure Setting the Properties of dataViewl 7. Drag a DataGrid control from the Windows Forms tab of the Toolbox to your form. This creates a DataGrid object named dataGridl. 8. Set the DataSource property of dataGridl to dataViewl using the drop-down list to the right of the DataSource property as shown in Figure . This binds the data stored in dataViewl to dataGridl and allows dataGridl to access any data stored in dataViewl. Figure Setting the Properties of dataGridl 9. Select View Code and set the Forml method of your form to 10. public Forml 11. 12. 13. Required for Windows Form Designer support 14. 15. InitializeComponent 16. 17. call the Fill method of .

TÀI LIỆU LIÊN QUAN
10    158    1
6    184    1
7    162    1
5    157    1
6    160    1
6    152    1
6    150    1
6    206    1
7    154    1
5    121    1