JavaScript Editor JavaScript Editor     JavaScript Debugger

Previous Section Next Section

Main Page

Creating a Dataset in Code

How do you create a dataset in code, then bind it to a data grid? To see how this works, take a look at the DataSetCode example on the CD-ROM, which I'll cover in the next few topics in this chapter. This example creates a connection object, a command object, a data adapter, and a dataset corresponding to the authors table in the pubs sample database, and then binds and displays that table in a data grid, as you see in Figure 22.1.

Figure 22.1: Creating a dataset in code.

To see how this example works, look at the next few topics.


This example uses a data connection and data adapter to retrieve data from a database. If you want to create a dataset entirely from scratch, no data connection needed, see "Creating a Data Table in Code" in this chapter.

Related solution:

Found on page:

Creating a Dataset


Previous Section Next Section

JavaScript Editor Free JavaScript Editor     JavaScript Editor