{{ message }}
Data
Directory actions
More options
Directory actions
More options
Data
Folders and files
<!--TO READ THIS HELP FILE, RIGHT-CLICK ON THE FILE NAME IN THE
SOLUTION EXPLORER PANE AND SELECT "VIEW IN BROWSER"-->
<html><head><title>Data Sample: Demonstrates Simple Access to a SQL Database</title></head><body><h1>Data Sample: Demonstrates Simple Access to a SQL Database</h1><div id="mainSection"><div id="mainBody"><div id="allHistory" class="saveHistory" onsave="saveAll()" onload="loadAll()"></div><p /><p>The Data sample demonstrates a simple query from an existing SQL database using the console. The result of the query is displayed and the program exits.</p><div class="alert"><table width="100%" cellspacing="0" cellpadding="0"><tr><th align="left">Note </th></tr><tr><td><p>The sample assumes an existing SQL server and table. To run this sample to completion, you must provide a SQL server, a database, and a table.</p></td></tr></table></div><div class="alert"><table width="100%" cellspacing="0" cellpadding="0"><tr><th align="left">Security Note </th></tr><tr><td><p>This sample code is provided to illustrate a concept and should not be used in applications or Web sites, as it may not illustrate the safest coding practices.</p></td></tr></table></div><h1 class="heading">Building and Running the Sample</h1><div id="sectionSection0" class="seeAlsoNoToggleSection"><h4 class="subHeading">To build and run Data using Visual Studio</h4><div class="subSection"><ol><li><p>In the Visual Studio IDE, load the solution file data.sln.</p></li><li><p>In Solution Explorer, right-click the <b>Data</b> solution.</p></li><li><p>On the shortcut menu, click <b>Build</b>.</p></li><li><p>On the <b>Debug</b> menu, click <b>Start</b>.</p></li></ol></div></div><h1 class="heading">Classes and Keywords</h1><div id="sectionSection1" class="seeAlsoNoToggleSection"><p>This sample demonstrates the following classes:</p><p>SQLDataReader; DataSet</p><p>This sample demonstrates the following keywords:</p><p>SQLDataReader; DataSet; SQL; Data</p></div></div><div id="footer"><div class="footerLine"></div>
© Microsoft Corporation. All rights reserved. Send <a href="mailto:DevDocs@microsoft.com?subject=Documentation Feedback :Data Sample: Demonstrates Simple Access to a SQL Database">comments</a> about this topic to Microsoft.
</div></div></body></html>
