Subject Re: [firebird-support] Save decimal data type
Author Francisco José Scheffer
Thanks André;

I've declarated the FbConnection, and FbCommand.
Everything works fine with connection and Command.

If I send a Query like this:
SQLString = "INSERT INTO MyTable(CANT) VALUES(MyAmount)"

considering the Field CANT as String, and the same thing for MyAmount,
FireBird has no problem to save the data.
the problem is, when CANT is Decimal data type, or Numeric, or Float.

Any one?

How to save a decimal data type in Firebird from an app??
doesn't matter if the programming languaje is other than VB.Net

I need to know how to save a decimal data into firebird like this: 25.80


Francisco José Scheffer

De: André Knappstein <Knappstein@...>
Para: Francisco José Scheffer <>
Enviado: miércoles, 29 de mayo de 2013 10:35
Asunto: Re: [firebird-support] Save decimal data type

to me this does not look like proper code for .net.
Personally I am using C#, but I know quite some of

You need:
- a Command object (of Type FbCommand)
- a Parameter object (of Typ FbParameter)

look at the following links for further guidance to in this

Have fun!

> thanks Ann;
> Here is some code;

> Declaration
> Dim MyAmount as Double /* Double - 64 bit floating-point number */

> Dim SQLString as String

> MyAmount = 25.80
> SQLString = "INSERT INTO MyTable(CANT) VALUES(MyAmount)"

> In Firebird, the field CANT is: (I've tried Numeric, Decimal and FLOAT also)
> With Decimal was 18,4
> Numeric was 12,2

> When Firebird save the data, it does as 2580, not 25.80;
> Is it perhaps a problem on my Windows regional settings?

> thanks for help!!

> Francisco José Scheffer

> ________________________________
> De: Ann Harrison <aharrison@...>
> Para:
> Enviado: martes, 28 de mayo de 2013 17:36
> Asunto: Re: [firebird-support] Save decimal data type

> On Tue, May 28, 2013 at 10:26 AM, franchessko <scheffer74@...> wrote:

>> Hi, I'm a new firebird user. I joined here to ask for help.
>> I develop in DotNet Technologies, and I have this problem:
>> And the problem is:
>> -------------------
>> When I send a Query with a decimal data type like '25.80' -without quotes-
>> the data is saved in firebird like this 2580,0000
>> (the database field was created as Decimal 18,4)

> Without seeing the actual queries you used, I'm guessing about why you see
> what you see, but I can tell you what Firebird is doing. When you store
> 25.80 in a column that's defined as decimal 18,4, Firebird stores the
> value as in integer, which in this case would be 258000 (two hundred fifty
> eight thousand). The scale is part of the field definition. Firebird uses
> the scale when doing comparisons, so 258000 scale 4 is more than 2570000
> scale 5 and less than 260 scale 1. All that is fine, internally.
> However, the SQL numeric and decimal types are based on data types used in
> COBOL. Those data types are not generally supported in more modern
> languages. When you retrieve a decimal or numeric value with a non-zero
> scale, you should probably ask for it as a floating point number or a
> string. You'll get better information from the Firebird .NET driver list
> on exactly how to push decimal and numeric values through that interface.

>> I tried sending the same number, but with the comma '25,80' but firebird
>> says: "Dynamic SQL Error. SQL Error code = -804. Count of read-write
>> columns does not equal count of values"

> Firebird does not use the locale to choose the separator between the
> integral and decimal portions of a number, so it's reading 25,80 as two
> values 25 and 80.

> Good luck,

> Ann

> [Non-text portions of this message have been removed]


> ------------------------------------

> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

> Visit and click the Resources item
> on the main (top) menu. Try Knowledgebase and FAQ links !

> Also search the knowledgebases at

> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> Yahoo! Groups Links

mit freundlichen Grüßen,

André Knappstein
EDV und Controlling
beta Eigenheim- und Grundstücksverwertungsgesellschaft mbH
Hafenweg 4
59192 Bergkamen-Rünthe

Telefon: +49 2389 9240 140
Telefax: +49 2389 9240 150
e-mail: knappstein@...

Amtsgericht Hamm Nr. B 420
Geschäftsführer: Achim Krähling, Dirk Salewski und Matthias Steinhaus

USt-IDNr.: DE 125215402

[Non-text portions of this message have been removed]