You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
DataSet Example<br />
public static void UseDataSet()<br />
{<br />
SqlConnection conn = new<br />
SqlConnection("server=localhost;database=pubs;trusted_connection=true");<br />
SqlCommand cmd = new SqlCommand("select * from authors",conn);<br />
SqlDataAdapter da = new SqlDataAdapter(cmd);<br />
DataSet ds = new DataSet();<br />
}<br />
da.Fill(ds);<br />
ds.WriteXml(Console.Out,System.Data.XmlWriteMode.IgnoreSchema);<br />
DataAdapter executes<br />
statement and pours<br />
results into the dataset<br />
DataAdapter is also<br />
smart enough to open the<br />
connection if needed and<br />
close it when finished<br />
95