segunda-feira, abril 10, 2006

Connecting to Firebird in C#

As i promissed i ll start posting some basic C# using firebird, first of all lets see how to open a simple connection using the firebird driver and C#.

First you need to add a reference to FirebirdSql.Data.Firebird in your project, and add: using FirebirdSql.Data.Firebird to your code.

Now, to open a connection, just do it:

private FbConnection con = new FbConnection("User=SYSDBA;" +
"Password=masterkey;" +
"Database=/path/to/your/database.gdb;" +
"DataSource=192.168.0.1;" +
"Port=3050;" +
"Dialect=3;" +
"Charset=ISO8859_1;");
try {
con.Open();
} catch (Exception ex) {
MessageBox.Show(ex.ToString());
}

Difficult isnt it?

quinta-feira, abril 06, 2006

Howto: Mono, SharpDevelop and Firebird on Windows

I took some time to make these 3 wonderfull things work together, but as I'm a nice guy, I'll save you the trouble and teach step by step how to make them work together.


Mono:

We can start installing mono, this is very easy, just download the installer from Here and install it.

After that you need to add the the mono install on the Windows Path.

To do that, right click on My Computer -> Properties -> Advanced -> Environment Vars, chose PATH on the list on the bottom and click on Edit.

You need to add mono´s bin folder, for example if you installed mono on: C:\Program Files\Mono, the path Would be: C:\Program Files\Mono\bin.

After doing this we need to set up another environment var, Click in New and Add this var:

MONO_EXTERNAL_ENCODINGS

Set it to this value:

default_locale

Now your mono is alive and kicking (At least it should be), now we are going to install the Firebird ADO.NET provider.


Firebird ADO.NET Provider:

Download Nant extract it to wherever you want and add the bin folder to the windows path, the same way you added the firebird bin folder.

Download and install Nunit 2.2

Download the Firebird 1.7 ADO.NET Provider Souce code

Extract the source code and execute the build.bat file that is located on the build/win32/ado.net folder of the source code you just extracted.

If everything is fine you should now have a FirebirdSql.Data.Firebird.dll, place this file wherever you want, you will need to use it on SharpDevelop.


SharpDevelop

To install SharpDevelop, just download the install from Here.

After installing it, to compile things on mono you need just to set the compiler, to do it, open up a new project, then click on the menu: Project -> Project Options -> Compiling, on then target Framework chose Mono 2.0.

To use firebird in your project, you need to add a reference to it, to do so, right click on References -> Add Mono Reference -> .NET Assembly Navigator -> Browse, and select your FirebirdSQl.Data.Firebird.dll.

Thats all you need to start making .NET Applications with Mono and Firebird using SharpDevelop.

C#, .NET and Firebird

Hi fellows, its been a long time since my last post, but thats because i m too busy to post here, and i didnt have anything usefull either, but now things are changed.

Its been around 6 months since i started working on my currenty company, and since the first day i started here i hear my boss saying that we are starting a new ERP system, but my co-workers always said that he said that for his whole life but never started.

So.. guess what.. i m starting it.

After talking a lot with him, i m making the project, database and documentation, for now we are still just in paper, but some things are already defined, and one of these things is the language and database that we are going to work with.

And that would be C# and Firebird.

But it isnt going just to stop there, as you may already know i love linux and i just use linux at home, even if most of our customers just run windows, we are making this thing run on linux and windows.. how?

The answer for that question is simple:

MONO

So i ve been very very busy learning C#, ADO.NET and trying to make everything work on mono.

But for now i m just saying this, soon i ll start posting some code snippets as usual, but the thing is:

Mono r0x!