Data.Linq and System.Data namespaces that you are used to having in your project.
Figure 14-1 shows the necessary references needed to work with LINQ to DataSet.
Once you have the necessary references in place, you need to make sure that you have included the
appropriate using directives:
272
Chapter 14: LINQ to DataSet
using System;
using System.Data.Common;
using System.Data.SqlClient;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Data.Linq;
using System.Text;
using System.Windows.Forms;
Then you are ready to go.
Figure 14-1
Loading Data into a DataSet
Before you can query a DataSet, it must be populated with data. The most popular way to do that is to
use the DataAdapter class to retrieve the data from the database. This section shows via example how to
populate a DataSet using the DataAdapter class so that it can later be queried with LINQ to DataSet.
Using the DataAdapater
If you have done any database development with .NET, you are intimately familiar with how to populate
a DataSet using SqlDataAdapter.
Pages:
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440