<docbook><section><title>VirtFirebirdVisualStudioDataGridFormsApp</title><bridgehead class="http://www.w3.org/1999/xhtml:h2"> Virtuoso ADO.Net Data Grid Form Application</bridgehead>
<para>This article details the steps required to create a simple Visual Studio 2008 Windows Form application with associated <ulink url="DataGridView">DataGridView</ulink> control for displaying data in selected tables from the target database.</para>
<orderedlist spacing="compact"><listitem>Launch the Visual Studio 2008 SP1 IDE.
<figure><graphic fileref="VirtFirebirdVisualStudioDataGridFormsApp/VirtFirebirdDataGrid_01.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="VirtFirebirdVisualStudioDataGridFormsApp/VirtFirebirdDataGrid_02.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="VirtFirebirdVisualStudioDataGridFormsApp/VirtFirebirdDataGrid_03.png" /></figure> </listitem>
<listitem>Click on the <emphasis>Add New Data Source</emphasis> link to add a new data source.
<figure><graphic fileref="VirtFirebirdVisualStudioDataGridFormsApp/VirtFirebirdDataGrid_04.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="VirtFirebirdVisualStudioDataGridFormsApp/VirtFirebirdDataGrid_05.png" /></figure> </listitem>
<listitem>In the <emphasis>Data Source Configuration Wizard</emphasis> dialog <emphasis>Choose your Data Connection page</emphasis>, select the <emphasis>New Connection button</emphasis>.
<figure><graphic fileref="VirtFirebirdVisualStudioDataGridFormsApp/VirtFirebirdDataGrid_06.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="VirtFirebirdVisualStudioDataGridFormsApp/VirtFirebirdDataGrid_07.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="VirtFirebirdVisualStudioDataGridFormsApp/VirtFirebirdDataGrid_08.png" /></figure> </listitem>
<listitem>Select the <emphasis>Select Database From List</emphasis> radio button and choose <emphasis>employee</emphasis> from the drop down list, assuming the Virtuoso Demo Database is installed.
<figure><graphic fileref="VirtFirebirdVisualStudioDataGridFormsApp/VirtFirebirdDataGrid_09.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="VirtFirebirdVisualStudioDataGridFormsApp/VirtFirebirdDataGrid_10.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="VirtFirebirdVisualStudioDataGridFormsApp/VirtFirebirdDataGrid_11.png" /></figure> </listitem>
<listitem>In the <emphasis>Choose your Database Objects</emphasis> dialog select the table and columns to be queried, the <emphasis>COUNTRY</emphasis> table is used in this example.
<figure><graphic fileref="VirtFirebirdVisualStudioDataGridFormsApp/VirtFirebirdDataGrid_12.png" /></figure> </listitem>
<listitem>A <ulink url="DataSet">DataSet</ulink> for the <emphasis>employee</emphasis> database object is created <figure><graphic fileref="VirtFirebirdVisualStudioDataGridFormsApp/VirtFirebirdDataGrid_13.png" /></figure> </listitem>
<listitem>From the drop down list box next to the <emphasis>COUNTRY</emphasis> table ensure the <emphasis>DataGridView</emphasis> item is selected <figure><graphic fileref="VirtFirebirdVisualStudioDataGridFormsApp/VirtFirebirdDataGrid_14.png" /></figure> </listitem>
<listitem>Drag the <emphasis>COUNTRY</emphasis> <ulink url="DataSet">DataSet</ulink> item onto the <emphasis>Form</emphasis> to create a scrollable and editable association of the <emphasis>COUNTRY</emphasis> table object with the Data Grid View automatically.
<figure><graphic fileref="VirtFirebirdVisualStudioDataGridFormsApp/VirtFirebirdDataGrid_15.png" /></figure> </listitem>
<listitem>From the <emphasis>Debug Menu</emphasis> select the <emphasis>Start Debugging</emphasis> menu item to run the application.
<figure><graphic fileref="VirtFirebirdVisualStudioDataGridFormsApp/VirtFirebirdDataGrid_16.png" /></figure> </listitem>
<listitem>The data in the <emphasis>COUNTRY</emphasis> table will be displayed in the DataGrid application created.
<figure><graphic fileref="VirtFirebirdVisualStudioDataGridFormsApp/VirtFirebirdDataGrid_17.png" /></figure> </listitem>
<listitem>A new row can be inserted (updated or deleted) as indicated for the new &quot;1111&quot; record inserted below and the <emphasis>Save</emphasis> button clicked to save the change to the database.
<figure><graphic fileref="VirtFirebirdVisualStudioDataGridFormsApp/VirtFirebirdDataGrid_18.png" /></figure> </listitem>
<listitem>The Virtuoso <emphasis>Interactive SQL</emphasis> tab of the Conductor can be used to run the query <emphasis>select * from &quot;employee&quot;.&quot;fire&quot;.&quot;COUNTRY&quot;</emphasis> <figure><graphic fileref="VirtFirebirdVisualStudioDataGridFormsApp/VirtFirebirdDataGrid_19.png" /></figure> </listitem>
<listitem>To verify the change has been successfully made in the database.
<figure><graphic fileref="VirtFirebirdVisualStudioDataGridFormsApp/VirtFirebirdDataGrid_20.png" /></figure></listitem>
</orderedlist><para>The task is now complete.
</para>
</section></docbook>