C:\Program Files\FirebirdClient
C:\Program Files\FirebirdClient
%Path%
to firebird client installation path in file C:\Program Files\FirebirdClient\DDEXProviderVS2010\FirebirdDDEXProviderPackageLess32.reg
(or the 64-bit equivalent file). Remember to escape backslashes. Eg: C:\\Program Files\\FirebirdClient\\FirebirdSql.VisualStudio.DataTools.dll
. [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0\DataProviders\{92421248-F044-483A-8237-74C7FBC62971}] @=".NET Framework Data Provider for Firebird" ... "CodeBase"="C:\\Program Files\\FirebirdClient\\FirebirdSql.VisualStudio.DataTools.dll" ...
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\…
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\9.0\…
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0\…
FirebirdDDEXProviderPackageLess32.reg
(double click file).FirebirdSql.Data.FirebirdClient
is in the .NET Global Assembly Cache (GAC): C:\Windows\assembly
, and browse for FirebirdSql.Data.FirebirdClient
C:\> gacutil /l FirebirdSql.Data.FirebirdClient
If it does not show up, add it (must use the gacutil for the .Net 2.0, so go into the same folder):
C:\> CD "C:\Program Files\FirebirdClient" C:\> gacutil /i "C:\Program Files\FirebirdClient\FirebirdSql.Data.FirebirdClient.dll"
machine.config
file under Config folder in the related Framework folder to register the provider:C:\Windows\Microsoft.NET\Framework\v2.0.50727\Config\machine.config
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config
<configuration> <configSections> ... <section name="firebirdsql.data.firebirdclient" type="System.Data.Common.DbProviderConfigurationHandler, System.Data, Version=%RuntimeVersion%, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> ... <configSections> <system.data> <DbProviderFactories> ... <add name="FirebirdClient Data Provider" invariant="FirebirdSql.Data.FirebirdClient" description=".Net Framework Data Provider for Firebird" type="FirebirdSql.Data.FirebirdClient.FirebirdClientFactory, FirebirdSql.Data.FirebirdClient, Version=%Version%, Culture=%Culture%, PublicKeyToken=%PublicKeyToken%" /> ... </DbProviderFactories> </system.data> .... </configuration>
And substitute:
%RuntimeVersion%
with the version of .NET Framework, either 2.0.0.0 (.NET 2.0, .NET 3.0, .NET 3.5) or 4.0.0.0 (.NET 4).%Version%
with the version of the provider assembly that you have in the GAC.%Culture%
with the culture of the provider assembly that you have in the GAC.%PublicKeyToken%
with the PublicKeyToken of the provider assembly that you have in the GAC.C:\Windows\assembly
, and browse for FirebirdSql.Data.FirebirdClient
gacutil
:C:\> gacutil /l FirebirdSql.Data.FirebirdClient
<configuration> <configSections> ... <section name="firebirdsql.data.firebirdclient" type="System.Data.Common.DbProviderConfigurationHandler, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> ... <configSections> <system.data> <DbProviderFactories> ... <add name="FirebirdClient Data Provider" invariant="FirebirdSql.Data.FirebirdClient" description=".Net Framework Data Provider for Firebird" type="FirebirdSql.Data.FirebirdClient.FirebirdClientFactory, FirebirdSql.Data.FirebirdClient, Version=2.5.2.0, Culture=neutral, PublicKeyToken=3750abcc3150b00c"/> ... </DbProviderFactories> </system.data> .... </configuration>
.NET Framework 4
. NOTE: .NET Framework 4 (Client Profile)
will not work.machine.config
matches the one in GAC.PATIENT
) .PATIENTTableAdapter
becomes patientTableAdapter1
on the form)WPF:
<Window x:Class="FirebirdDBApp.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"> <Grid> <DataGrid ItemsSource="{Binding}"></DataGrid> </Grid> </Window>
C#:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; namespace FirebirdDBApp { /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); // construct dataset datasetEzFITDB ds = new datasetEzFITDB(); // use a table adapter to populate the patients table datasetEzFITDBTableAdapters.PATIENTTableAdapter adapt = new datasetEzFITDBTableAdapters.PATIENTTableAdapter(); adapt.Fill(ds.PATIENT); // use the Patient table as the DataConext for this Window this.DataContext = ds.PATIENT.DefaultView; } } }
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace Sample1 { public partial class frmMain : Form { public frmMain() { InitializeComponent(); } private void frmMain_Load(object sender, EventArgs e) { this.patientTableAdapter1.Fill(this.datasetEzFITDB.PATIENT); } } }
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):
Source: {#LibDir}\FirebirdClient\FirebirdSql.Data.FirebirdClient.dll; DestDir: {win}\assembly; Flags: gacinstall sharedfile; StrongAssemblyName: "FirebirdSql.Data.FirebirdClient, Version=2.6.0.0, Culture=neutral, PublicKeyToken=3750abcc3150b00c, ProcessorArchitecture=MSIL"
dataSetEzFITDB1BindingSource
or PATIENTBindingSource
).PATIENT
) if DataSource points only to a DataSet binding source (eg. dataSetEzFITDB1BindingSource
), as opposed to a table binding source (eg. PATIENTBindingSource
).PATIENT
…PATIENT
and field LASTNAME
…PATIENTBindingSource - LASTNAME
. The data binding dialog allows customization:PATIENT
:PATIENTBindingSource
dataSetEzFITDB1
PATIENT
PATIENT
:PATIENTBindingNavigator
Navigator for Patient Table
PATIENTBindingSource
PATIENT
and field LASTNAME
:PATIENTBindingSource
LASTNAME
Add the following to the app.exe.config
file (must reside in the same folder and the app.exe
. See Application Settings and Configuration.ConnectionStrings for more details):
Using database server:
<?xml version="1.0"?> <configuration> <configSections> </configSections> ... <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" connectionString="Charset=NONE; ServerType=0; DataSource=localhost; Database=C:\Program Files\Acme\MyApp\data\mydb.gdb; User=SYSDBA; Password=masterkey; Dialect=3" providerName="FirebirdSql.Data.FirebirdClient" /> </connectionStrings> <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup> ... </configuration>
Using embedded database:
<?xml version="1.0"?> <configuration> <configSections> </configSections> ... <connectionStrings> <add name="Acme.App.Database.Properties.Settings.MyAppDB_localhost" connectionString="Charset=NONE; ServerType=1; Database=C:\Program Files\Acme\MyApp\data\mydb.gdb; User=SYSDBA; Password=masterkey; Dialect=3" providerName="FirebirdSql.Data.FirebirdClient" /> </connectionStrings> <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup> ... </configuration>
Add the following files to distribute:
[Files] ... ;--------------------------------------------------- ; Data files ;--------------------------------------------------- Source: ..\Data\mydb.gdb; DestDir: {app}\data\; Flags: onlyifdoesntexist ;--------------------------------------------------- ; Database Engine files ;--------------------------------------------------- ; Firebird Client Source: {#LibDir}\FirebirdClient\FirebirdSql.Data.FirebirdClient.dll; DestDir: {win}\assembly; Flags: gacinstall sharedfile; StrongAssemblyName: FirebirdSql.Data.FirebirdClient, Version=2.6.0.0, Culture=neutral, PublicKeyToken=3750abcc3150b00c, ProcessorArchitecture=MSIL ;Source: {#LibDir}\firebird\fbembed.dll; DestDir: {app}; DestName: gds32.dll Source: {#LibDir}\firebird\fbembed.dll; DestDir: {app} ; Firebird Embedded Server Source: {#LibDir}\firebird\ib_util.dll; DestDir: {app} Source: {#LibDir}\firebird\icudt30.dll; DestDir: {app} Source: {#LibDir}\firebird\icuin30.dll; DestDir: {app} Source: {#LibDir}\firebird\icuuc30.dll; DestDir: {app} Source: {#LibDir}\firebird\firebird.msg; DestDir: {app}; Flags: ignoreversion Source: {#LibDir}\firebird\firebird.conf; DestDir: {app}; Flags: ignoreversion Source: {#LibDir}\firebird\udf\fbudf.dll; DestDir: {app}\udf Source: {#LibDir}\firebird\intl\fbintl.dll; DestDir: {app}\intl; Flags: regserver noregerror Source: {#LibDir}\firebird\intl\fbintl.conf; DestDir: {app}\intl; Flags: ignoreversion ...
Add support for creating the app.config
file:
... [Code] //---------------------------------------------------------------------------- // global types //---------------------------------------------------------------------------- Type ... //---------------------------------------------------------------------------- // global variables //---------------------------------------------------------------------------- var ... //---------------------------------------------------------------------------- // function prototypes //---------------------------------------------------------------------------- procedure DoPostInstall(); forward; procedure CreateConfigFile(ServerName: string; DBPath: string); forward; //---------------------------------------------------------------------------- // description: PostInstall custom code. This code executes after wizard is done. // parameters : void // return : void //---------------------------------------------------------------------------- procedure DoPostInstall(); var ResultCode: integer; begin Log('DoPostInstall(): entering...'); //debug //--------------------------- // Post installation //--------------------------- // unregister old DLLs // register DLLs // create registry entries // remove old registry entries // create Icon group ... // Create Config (Settings) file CreateConfigFile('localhost', ExpandConstant('{app}\data\mydb.gdb') ); end; //---------------------------------------------------------------------------- // description: Create the config file. // parameters : void // return : void //---------------------------------------------------------------------------- procedure CreateConfigFile(ServerName: string; DBPath: string); var str: array [0..15] of string; begin str[0] := '<?xml version="1.0"?>'; str[1] := '<configuration>'; str[2] := '<configSections>'; str[3] := '</configSections>'; str[4] := '<connectionStrings>'; str[5] := ' <add name="Acme.App.Database.Properties.Settings.MyAppDB_localhost"'; // For Database Server: //str[6] := ' connectionString="character set=NONE;ServerType=0;data source=localhost;initial catalog=C:\myapp\data\mydb.gdb;user id=SYSDBA;password=masterkey;dialect=3"'; //str[6] := ' connectionString="character set=NONE;ServerType=0;data source='+ ServerName + ';Database=' + DBPath + ';user id=SYSDBA;password=masterkey;dialect=3"'; // For Embedded Database: str[6] := ' connectionString="character set=NONE;ServerType=1;Database=' + DBPath + ';user id=SYSDBA;password=masterkey;dialect=3"'; str[7] := ' providerName="FirebirdSql.Data.FirebirdClient" />'; str[8] := '</connectionStrings>'; str[9] := '<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup>'; str[10] := '</configuration>'; SaveStringsToFile(ExpandConstant('{app}\myapp.exe.config'), str, False); end; ...