<docbook><section><title>VirtAdoNetDataGridApp</title><title> Virtuoso ADO.Net Data Grid Form Application</title> Virtuoso ADO.Net Data Grid Form Application
<bridgehead class="http://www.w3.org/1999/xhtml:h2"> Introduction</bridgehead>
<para>This article details the steps required to create a simple Visual Studio 2008 Windows Form application with associated DataGridView control for displaying data in selected tables from a Virtuoso database.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h2"> Pre-requisites</bridgehead>
<orderedlist spacing="compact"><listitem>Microsoft Visual Studio 2008 SP1, which includes the ADO.NET Entity Framework runtime and associated tools </listitem>
<listitem>A running Virtuoso Universal Server instance</listitem>
</orderedlist><bridgehead class="http://www.w3.org/1999/xhtml:h2"> Steps</bridgehead>
<orderedlist spacing="compact"><listitem>Launch the Visual Studio 2008 SP1 IDE.
<figure><graphic fileref="VirtAdoNetDataGridApp/VirtAdoNetDataGridApp1.png" /></figure> </listitem>
<listitem>Create a <emphasis>Web Application</emphasis> project by going to the <emphasis>File</emphasis> menu in Visual Studio and choosing <emphasis>New Project</emphasis>.
  </listitem>
<listitem>When the New Project window appears, choose either <emphasis>Visual Basic</emphasis> or <emphasis>Visual C#</emphasis> as the programming language. </listitem>
<listitem>Within the language category, click on <emphasis>Windows</emphasis> and select <emphasis>Windows Form Application</emphasis> from the right-hand panel.
  </listitem>
<listitem>Choose a name for the project, for example <emphasis>VirtuosoDataGridApp</emphasis>, and click <emphasis>OK</emphasis>.
<figure><graphic fileref="VirtAdoNetDataGridApp/VirtAdoNetDataGridApp1_1.png" /></figure> </listitem>
<listitem>From the <emphasis>Data</emphasis>, menu select the <emphasis>Show Data Sources</emphasis> menu item to display a list of available Data sources.
<figure><graphic fileref="VirtAdoNetDataGridApp/VirtAdoNetDataGridApp2.png" /></figure> </listitem>
<listitem>Click on the <emphasis>Add New Data Source</emphasis> link to add a new data source.
<figure><graphic fileref="VirtAdoNetDataGridApp/VirtAdoNetDataGridApp3.png" /></figure> </listitem>
<listitem>In the <emphasis>Data Source Configuration Wizard</emphasis> dialog <emphasis> Choose Data Source Type</emphasis> page, select the <emphasis>Database</emphasis> data source type and click <emphasis>Next</emphasis>.
<figure><graphic fileref="VirtAdoNetDataGridApp/VirtAdoNetDataGridApp4.png" /></figure> </listitem>
<listitem>In the <emphasis>Data Source Configuration Wizard</emphasis> dialog <emphasis>Choose your Data Connection</emphasis> page, select the <emphasis>New Connection</emphasis> button.
<figure><graphic fileref="VirtAdoNetDataGridApp/VirtAdoNetDataGridApp5.png" /></figure> </listitem>
<listitem>In the <emphasis>Choose Data Source</emphasis> dialog, select <emphasis>OpenLink Virtuoso Data Source</emphasis> from the list and click <emphasis>Continue</emphasis>.
<figure><graphic fileref="VirtAdoNetDataGridApp/VirtAdoNetDataGridApp6.png" /></figure> </listitem>
<listitem>In the <emphasis>Add Connection</emphasis> dialog, specify the <emphasis>hostname</emphasis>, <emphasis>portno</emphasis>, <emphasis>username</emphasis>, and <emphasis>password</emphasis> for the target Virtuoso Server and and check the <emphasis>Save Password</emphasis> check box.
<figure><graphic fileref="VirtAdoNetDataGridApp/VirtAdoNetDataGridApp7.png" /></figure> </listitem>
<listitem>Select the <emphasis>Select Database From List</emphasis> radio button and choose <emphasis>Demo</emphasis> from the drop down list, assuming the Virtuoso Demo Database is installed.
<figure><graphic fileref="VirtAdoNetDataGridApp/VirtAdoNetDataGridApp8.png" /></figure> </listitem>
<listitem>Click the <emphasis>Test Connection</emphasis> button to verify the connection is successful and then click <emphasis>OK</emphasis> to add the connection. <figure><graphic fileref="VirtAdoNetDataGridApp/VirtAdoNetDataGridApp9.png" /></figure> </listitem>
<listitem>Select the <emphasis> Yes, include sensitive data in the connect string</emphasis> radio button and click <emphasis>Next</emphasis> to continue.
<figure><graphic fileref="VirtAdoNetDataGridApp/VirtAdoNetDataGridApp11.png" /></figure> </listitem>
<listitem>In the <emphasis>Choose your Database Objects</emphasis> dialog select the table and columns to be queried, the shippers table is used in this example.
<figure><graphic fileref="VirtAdoNetDataGridApp/VirtAdoNetDataGridApp12.png" /></figure> </listitem>
<listitem>A <emphasis>DataSet</emphasis> for the shippers database object is created <figure><graphic fileref="VirtAdoNetDataGridApp/VirtAdoNetDataGridApp13.png" /></figure> </listitem>
<listitem>From the drop down list box next to the <emphasis>Shippers</emphasis> table ensure the <emphasis>DataGridView</emphasis> item is selected <figure><graphic fileref="VirtAdoNetDataGridApp/VirtAdoNetDataGridApp13_1.png" /></figure> </listitem>
<listitem>Drag the <emphasis>Shippers</emphasis> DataSet item onto the <emphasis>Form</emphasis> to create a scrollable and editable association of the Shippers table object with the Data Grid View automatically.
<figure><graphic fileref="VirtAdoNetDataGridApp/VirtAdoNetDataGridApp14.png" /></figure> </listitem>
<listitem>From the <emphasis>Debug</emphasis> Menu select the <emphasis>Start Debugging</emphasis> menu item to run the application.
<figure><graphic fileref="VirtAdoNetDataGridApp/VirtAdoNetDataGridApp15.png" /></figure> </listitem>
<listitem>The data in the Shippers table will be displayed in the DataGrid application created.
<figure><graphic fileref="VirtAdoNetDataGridApp/VirtAdoNetDataGridApp16.png" /></figure> </listitem>
<listitem>A new row can be inserted (updated or deleted) as indicated  for the new DHL record inserted below and the <emphasis> save</emphasis> button clicked to save the change to the database.
<figure><graphic fileref="VirtAdoNetDataGridApp/VirtAdoNetDataGridApp17.png" /></figure> </listitem>
<listitem>The Virtuoso <emphasis>Interactive SQL</emphasis> tab of the Conductor can be used to run the query <emphasis>select * from Demo..Shippers</emphasis>.
<figure><graphic fileref="VirtAdoNetDataGridApp/VirtAdoNetDataGridApp18.png" /></figure> </listitem>
<listitem>To verify the change has been successfully made in the database.
<figure><graphic fileref="VirtAdoNetDataGridApp/VirtAdoNetDataGridApp19.png" /></figure></listitem>
</orderedlist><para>The task is now complete.</para>
</section></docbook>