O'Reilly logo

Sams Teach Yourself ADO.NET in 24 Hours by Paul Bertucci, Jason Lefebvre

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating DataSet Schema

In the next few sections, you'll see how to create a new DataSet and new DataTable. You'll also see how to manually create the DataTable schema using DataColumns. Finally, you will add some data to the DataSet using the DataRow object.

Instantiating a New DataSet

The first step to working with a DataSet is to create a new instance of a DataSet object. You can do this by using the following code in Visual Basic .NET:

Dim dsCompany as New DataSet()

or like this using C#:

DataSet dsCompany = new DataSet();

Adding a DataTable

When you have a DataSet object, the next step is to add a DataTable. The DataTable contains the columns and rows that make up the data you'll add later. To add a new table to the DataSet, you use ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required