Both sides previous revision
Previous revision
Next revision
|
Previous revision
|
swdev:dotnet:firebird_databases_in_.net [2011/04/06 08:42] smayr [Configuration File] |
swdev:dotnet:firebird_databases_in_.net [2016/02/23 14:01] (current) smayr [Configuration File] |
* Download from [[http://www.firebirdsql.org/index.php?op=files&id=netprovider|Main Site]] or [[http://www.firebirdsql.org/dotnetfirebird/download/index.html|DotNetFirebird]] | * Download from [[http://www.firebirdsql.org/index.php?op=files&id=netprovider|Main Site]] or [[http://www.firebirdsql.org/dotnetfirebird/download/index.html|DotNetFirebird]] |
* [[http://www.firebirdfaq.org|Firebird FAQ]] | * [[http://www.firebirdfaq.org|Firebird FAQ]] |
* [[http://www.firebirdsql.org/dotnetfirebird/developers-documenation.html|DotNetFirebird Developer's Documentation]] | * [[http://www.firebirdsql.org|Firebird SQL]] |
* [[http://www.firebirdsql.org/firebirdtutorial/index.html|Firebird Tutorial for .NET 2.0]] | |
* [[http://www.firebirdsql.org/firebirdtutorial/firebird-and-visual-studio-net-2005.html|Firebird and VS 2005 .NET]] | |
* [[http://msdn.microsoft.com/en-us/library/bwy42y0e.aspx|MSDN: DataSet Class]] | * [[http://msdn.microsoft.com/en-us/library/bwy42y0e.aspx|MSDN: DataSet Class]] |
* [[http://msdn.microsoft.com/en-us/library/9186hy08.aspx|MSDN: DataTable Class]] | * [[http://msdn.microsoft.com/en-us/library/9186hy08.aspx|MSDN: DataTable Class]] |
* [[http://en.csharp-online.net/Presenting_Data_with_the_DataGridView_Control_in_.NET_2.0|Presenting Data with DataGridView]] | * [[http://en.csharp-online.net/Presenting_Data_with_the_DataGridView_Control_in_.NET_2.0|Presenting Data with DataGridView]] |
* [[http://www.codeproject.com/KB/database/Using_Firebird_ADO_NET.aspx|Beginner’s Tutorial on Using the Firebird ADO.NET Client 2.5]] | * [[http://www.codeproject.com/KB/database/Using_Firebird_ADO_NET.aspx|Beginner’s Tutorial on Using the Firebird ADO.NET Client 2.5]] |
| * [[http://ibexpert.net/ibe/index.php?n=Doc.StoredProcedure|Stored Procedures]] |
| |
== Installation and Setup == | == Installation and Setup == |
| |
=== DDEX: Support for Visual Studio === | === DDEX: Support for Visual Studio === |
| |
==== Registry Update === | ==== Registry Update === |
* Add references in Registry: | * Add references in Registry: |
* 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): |
| |
</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: |
* 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. |
* 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. |
* 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; |
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: |
* 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 === |
... | ... |
<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> |
<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> |