Now you can click on the Preview Data… hyperlink which opens up the Preview Data window as shown in Figure 19. The Select an object to preview field gets populated automatically to run the getData () method. When you click on the Preview button, the grey area is populated by a table showing the retrieved rows of data from the Customers table as shown in Figure 19.
Click on the Close button in the above window. In the various tasks of the DataGridView many options are chosen by default. You may also check reordering of the column by placing a check mark in the Edit Column Reordering in Figure 18 which opens Edit Columns window as shown in Figure 20, another useful control to manipulate the columns so that the columns you want to see are the first few columns.
You may want to edit the columns and change some of the items such as reordering of the columns, column name, column width, etc. All this can be done from this screen. For this tutorial only the columns width was changed. A label was added and its text was changed to, “Demo 10 Database Customers” as shown in Figure 21.
Build the project from the main menu item, Build. Now when the program is run by clicking the Debug –> Start without debugging, or by pressing Ctrl+F5, the program runs and Form1 is displayed as shown in Figure 22.
Figure 23 shows the properties of the dataset DsAny that is created when the data source was created.
The schema of the above dataset is shown in Figure 24. This gets added to the project files in the Solution Explorer.
Using the smart tasks on the CustomerBindingSource you can carry out few of the indicated tasks shown in Figure 25.
The properties of the CustomerBindingSource are shown in Figure 26.
The CustomerTableAdapter directly connects to the database and it has its own properties window as shown in Figure 27. You will be able to edit queries in the dataset designer, add query, etc using the hyperlinks at the bottom of the properties window.
Alternatively you will be able to carry out similar tasks from the smart tasks on the CustomerTableAdapter component in the component tray as shown in Figure 28. In Microsoft applications, you have more than one way of carrying out a task.
The Object Browser shown in Figure 29 for this project shows the various data related classes that are used in the application working behind scenes as not a single line of code was explicitly used for this form to display the data.