Subject | Re: [firebird-support] Save decimal data type |
---|---|
Author | André Knappstein |
Post date | 2013-05-29T13:35:33Z |
Francisco,
to me this does not look like proper code for .net.
Personally I am using C#, but I know quite some of VB.net.
You need:
- a Command object (of Type FbCommand)
- a Parameter object (of Typ FbParameter)
look at the following links for further guidance to VB.net in this
regard:
http://www.dreamincode.net/forums/topic/165141-sql-parameters-from-vbnet/
http://idealprogrammer.com/net-languages/code-samples/vbnet-sql-parameters-source-code-insert-statement/
http://www.java2s.com/Code/VB/Database-ADO.net/PassParameterintoSQLcommand.htm
Have fun!
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
to me this does not look like proper code for .net.
Personally I am using C#, but I know quite some of VB.net.
You need:
- a Command object (of Type FbCommand)
- a Parameter object (of Typ FbParameter)
look at the following links for further guidance to VB.net in this
regard:
http://www.dreamincode.net/forums/topic/165141-sql-parameters-from-vbnet/
http://idealprogrammer.com/net-languages/code-samples/vbnet-sql-parameters-source-code-insert-statement/
http://www.java2s.com/Code/VB/Database-ADO.net/PassParameterintoSQLcommand.htm
Have fun!
> thanks Ann;mit freundlichen Grüßen,
> 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: firebird-support@yahoogroups.com
> 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 http://www.firebirdsql.org and click the Resources item
> on the main (top) menu. Try Knowledgebase and FAQ links !
> Also search the knowledgebases at http://www.ibphoenix.com
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> Yahoo! Groups Links
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