Database Reference
In-Depth Information
XML. (One way in Visual Studio is to use File
Open File.) Figure 15-17 shows
the XML extracted for the first five product rows.
Figure 15-17.
Data table extracted as XML
Tip
By default, extracted XML documents are plain-text files. You can open the
productstable.xml
file in any
editor or even use the
type
or
more
commands to view it from the command line.
How It Works
First we need to create a Select query to pull data from database.
// Query
string qry = @"select Name ,ProductNumber
from Production.Product";
Next we need to Create Data Set and Data Adapter
// Create Data Adapter
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = new SqlCommand(qry, conn);