Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
swdev:dotnet:firebird_databases_in_.net [2012/02/13 11:13]
smayr [Resources]
swdev:dotnet:firebird_databases_in_.net [2016/02/23 14:01] (current)
smayr [Configuration File]
Line 26: Line 26:
  
 === DDEX: Support for Visual Studio === === DDEX: Support for Visual Studio ===
 +
 ==== Registry Update === ==== Registry Update ===
  * Add references in Registry:  * Add references in Registry:
Line 38: Line 39:
      * For VS2010: ''HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0\...''      * For VS2010: ''HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0\...''
    * Add registry (perform with admin rights) using ''FirebirdDDEXProviderPackageLess32.reg'' (double click file).    * Add registry (perform with admin rights) using ''FirebirdDDEXProviderPackageLess32.reg'' (double click file).
 +
 ==== Install Assembly in GAC ==== ==== Install Assembly in GAC ====
  * Verify that ''FirebirdSql.Data.FirebirdClient'' is in the .NET Global Assembly Cache (GAC):   * Verify that ''FirebirdSql.Data.FirebirdClient'' is in the .NET Global Assembly Cache (GAC): 
Line 102: Line 104:
  
 </code> </code>
 +
 == Adding Firebird Support in an Application == == Adding Firebird Support in an Application ==
   * Open MS Visual Studio, and create or open a project:   * Open MS Visual Studio, and create or open a project:
Line 123: Line 126:
     * Server Type: Super/Classic Server     * Server Type: Super/Classic Server
 {{:swdev:howto:firebird-dotnet-vs2008-addconnection.jpg|Adding a Firebird data connection in MS Visual Studio 2008}} {{:swdev:howto:firebird-dotnet-vs2008-serverexplorer.jpg|Server Explorer after adding Firebird data connection in MS Visual Studio 2008}} {{:swdev:howto:firebird-dotnet-vs2008-addconnection.jpg|Adding a Firebird data connection in MS Visual Studio 2008}} {{:swdev:howto:firebird-dotnet-vs2008-serverexplorer.jpg|Server Explorer after adding Firebird data connection in MS Visual Studio 2008}}
 +
 === Data Source === === Data Source ===
   * Add Data Source.    * Add Data Source. 
Line 145: Line 149:
     * Review DataSource and DataSet:     * Review DataSource and DataSet:
       * {{:swdev:dotnet:firebird-dotnet-proj-datasources.jpg|Data Sources listed in Server Explorer (MS Visual Studio 2010) after adding Firebird data source}}{{:swdev:dotnet:firebird-dotnet-proj-solutionexplorer-dataset.jpg|DataSet listed in Solution Explorer (MS Visual Studio 2010) after adding Firebird data source}}       * {{:swdev:dotnet:firebird-dotnet-proj-datasources.jpg|Data Sources listed in Server Explorer (MS Visual Studio 2010) after adding Firebird data source}}{{:swdev:dotnet:firebird-dotnet-proj-solutionexplorer-dataset.jpg|DataSet listed in Solution Explorer (MS Visual Studio 2010) after adding Firebird data source}}
 +
 === Data-aware Controls === === Data-aware Controls ===
   * In the application form (GUI), add DataSet component, add DataGridView component and link to Data Source in current project.   * In the application form (GUI), add DataSet component, add DataGridView component and link to Data Source in current project.
Line 208: Line 213:
     * Test queries by selecting TableAdapter component in form, then right-clicking and "Preview Data".     * Test queries by selecting TableAdapter component in form, then right-clicking and "Preview Data".
     * If editing is necessary, select DataSet or TableAdapter component in form, then right-click and "Edit in DataSet Designer".     * If editing is necessary, select DataSet or TableAdapter component in form, then right-click and "Edit in DataSet Designer".
-    * Rearrange tables for easy view.  +    * Rearrange tables for easy view. {{:swdev:howto:firebird-dotnet-vs2008-dataset-designer.jpg|VS2008 DataSet Designer}} 
-      {{:swdev:howto:firebird-dotnet-vs2008-dataset-designer.jpg|VS2008 DataSet Designer}} +    * Create queries using Query Builder. While in the DataSet Designer, right-click on a table, then Configure > Query Builder. Select necessary fields, then < Finish >. {{:swdev:howto:firebird-dotnet-vs2008-tableadapterconfigwzd.jpg|VS2008 TableAdapter Configuration Wizard}} {{:swdev:howto:firebird-dotnet-vs2008-querybuilder.jpg|VS2008 Query Builder}}
-    * Create queries using Query Builder. While in the DataSet Designer, right-click on a table, then Configure > Query Builder. Select necessary fields, then < Finish >.  +
-      {{:swdev:howto:firebird-dotnet-vs2008-tableadapterconfigwzd.jpg|VS2008 TableAdapter Configuration Wizard}} {{:swdev:howto:firebird-dotnet-vs2008-querybuilder.jpg|VS2008 Query Builder}}+
   * Fill DataGridView with table data. Add the following code to the main form: <code csharp>   * Fill DataGridView with table data. Add the following code to the main form: <code csharp>
 using System; using System;
Line 242: Line 245:
 In ''[Files]]'' section, add global assembly cache (GAC) registration for ''FirebirdSql.Data.FirebirdClient.dll'' (one line, where {#LibDir} is where the source file is located): In ''[Files]]'' section, add global assembly cache (GAC) registration for ''FirebirdSql.Data.FirebirdClient.dll'' (one line, where {#LibDir} is where the source file is located):
 <code> <code>
-Source: {#LibDir}\FirebirdClient\FirebirdSql.Data.FirebirdClient.dll; DestDir: {win}\assembly; Flags: gacinstall sharedfile;  +Source: {#LibDir}\FirebirdClient\FirebirdSql.Data.FirebirdClient.dll;  
-        StrongAssemblyName: "FirebirdSql.Data.FirebirdClient, Version=2.6.0.0, Culture=neutral, PublicKeyToken=3750abcc3150b00c, ProcessorArchitecture=MSIL"+   DestDir: {win}\assembly; Flags: gacinstall sharedfile;  
 +   StrongAssemblyName: "FirebirdSql.Data.FirebirdClient, Version=2.6.0.0, Culture=neutral,  
 +      PublicKeyToken=3750abcc3150b00c, ProcessorArchitecture=MSIL"
 </code> </code>
 +
 == Components with Data Binding == == Components with Data Binding ==
 +
 === DataGridView === === DataGridView ===
   * Add DataGridView component to a form.  Set the following properties:   * Add DataGridView component to a form.  Set the following properties:
Line 257: Line 264:
      * In TextBox component properties, go to Data > DataBindings > Advanced.      * In TextBox component properties, go to Data > DataBindings > Advanced.
      * Select Bindings > Other Data Sources > Project Data Sources, and pick one data source.       * Select Bindings > Other Data Sources > Project Data Sources, and pick one data source. 
-       {{:swdev:howto:firebird-dotnet-vs2008-advancebinding-dialog1.jpg|Advanced Data Binding dialog}}+{{:swdev:howto:firebird-dotnet-vs2008-advancebinding-dialog1.jpg|Advanced Data Binding dialog}}
        * Select a table under the data source. Eg: For table ''PATIENT''...        * Select a table under the data source. Eg: For table ''PATIENT''...
-         {{:swdev:howto:firebird-dotnet-vs2008-advancebinding-dialog2.jpg|Advanced Data Binding dialog}}+{{:swdev:howto:firebird-dotnet-vs2008-advancebinding-dialog2.jpg|Advanced Data Binding dialog}}
        * Select a field under the table. Eg: For table ''PATIENT'' and field ''LASTNAME''...        * Select a field under the table. Eg: For table ''PATIENT'' and field ''LASTNAME''...
-         {{:swdev:howto:firebird-dotnet-vs2008-advancebinding-dialog3.jpg|Advanced Data Binding dialog}}+{{:swdev:howto:firebird-dotnet-vs2008-advancebinding-dialog3.jpg|Advanced Data Binding dialog}}
      * The data binding string should look like ''PATIENTBindingSource - LASTNAME'' The data binding dialog allows customization:      * The data binding string should look like ''PATIENTBindingSource - LASTNAME'' The data binding dialog allows customization:
-       {{:swdev:howto:firebird-dotnet-vs2008-advancebinding-dialog4.jpg|Advanced Data Binding dialog}}+{{:swdev:howto:firebird-dotnet-vs2008-advancebinding-dialog4.jpg|Advanced Data Binding dialog}}
  
 === BindingNavigator === === BindingNavigator ===
Line 296: Line 303:
 ... ...
 <connectionStrings> <connectionStrings>
 +   <!--<add name="Acme.App.Database.Properties.Settings.MyAppDB_localhost"
 +        connectionString="character set=NONE;
 +            ServerType=0;
 +            data source=localhost;
 +            initial catalog=C:\Program Files\Acme\MyApp\data\mydb.gdb;
 +            user id=SYSDBA;
 +            password=masterkey;
 +            dialect=3"
 +        providerName="FirebirdSql.Data.FirebirdClient" />-->
    <add name="Acme.App.Database.Properties.Settings.MyAppDB_localhost"    <add name="Acme.App.Database.Properties.Settings.MyAppDB_localhost"
-        connectionString="character set=NONE;ServerType=0;data source=localhost;initial catalog=C:\Program Files\Acme\MyApp\data\mydb.gdb;user id=SYSDBA;password=masterkey;dialect=3" +        connectionString="Charset=NONE; 
-        providerName="FirebirdSql.Data.FirebirdClient" />+            ServerType=0; 
 +            DataSource=localhost; 
 +            Database=C:\Program Files\Acme\MyApp\data\mydb.gdb; 
 +            User=SYSDBA; 
 +            Password=masterkey; 
 +            Dialect=3" 
 +        providerName="FirebirdSql.Data.FirebirdClient" />     
 </connectionStrings> </connectionStrings>
 <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup> <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup>
Line 314: Line 336:
 <connectionStrings> <connectionStrings>
    <add name="Acme.App.Database.Properties.Settings.MyAppDB_localhost"    <add name="Acme.App.Database.Properties.Settings.MyAppDB_localhost"
-        connectionString="ServerType=1;database=C:\Program Files\Acme\MyApp\data\mydb.gdb;user=SYSDBA;password=masterkey;dialect=3"+        connectionString="Charset=NONE; 
 +            ServerType=1; 
 +            Database=C:\Program Files\Acme\MyApp\data\mydb.gdb; 
 +            User=SYSDBA; 
 +            Password=masterkey; 
 +            Dialect=3"
         providerName="FirebirdSql.Data.FirebirdClient" />         providerName="FirebirdSql.Data.FirebirdClient" />
 </connectionStrings> </connectionStrings>