B4J Question [Please ignored]Sorry wrong post

incendio

Well-Known Member
Licensed User
Longtime User
Hi guys,

I got a wrong return value from B4J.

My code something like this
B4X:
Sub Test
  Private Brt,Nt,Dsc As Double
  Dsc = GetDsc(1250)
end Sub

Sub GetDsc(IdDsc As Int) As Double
    Private Qry As SQL
    Private Dsc As Double
    Qry = dbpool.GetConnection
    Dsc = Qry.ExecQuerySingleResult("select dsc from m_dsc where id = " & IdDsc)
    Qry.Close
    Return Dsc
End Sub

On firebird database, field dsc is numeric(7,4) value is 24.0000, but return value from Sub GetDsc is 24.0916.

Am I missing something here?

EDIT
====
Sorry, my mistake, turn out our admin change field value manually.
 
Last edited:

incendio

Well-Known Member
Licensed User
Longtime User
While this code is harmless, it is still considered bad practice.

Better:
B4X:
Dsc = Qry.ExecQuerySingleResult2("select dsc from m_dsc where id = ?", Array(IdDsc))
I knew, it was the old codes, thanks anyway for your reminder.
 
Upvote 0
Top