[Gambas-user] Can't exec an sql string

R. Stormo rohnny at ...1248...
Mon Oct 23 16:53:52 CEST 2006




Fabricio Silva-2 wrote:
> 
> Hello guys,
> 
> I have this sql:  "select price from product order by cast (price as
> char)"
> When I execute this sql inside phpMyAdmin it comes with the right result.
> But when executing the sql inside Gambas 1.9.34 it comes with the error:
> "Query failde: You have an error in your SQL syntax; check the manual that
> corresponds to your MySQL server version for the right syntax to use
> near('price, ....."
> I'm using price as varchar because in Brazil we use 147,00 instead of
> 147.00and I haven't figure out yet a way of showing the result with
> ","  whether
> than dot when I use decimal or float types.
> 
> Regards
> Fabricio Silva
> 
> 
> 
What about dont put the price at char it should come out as you want?

You could do a  , nasty one,
dim myprice as string
   myprice = rs!price
  if myprice<>"" and NOT isNull(myprice) then 
      myprice = replace(myprice,".","-")
      myprice = replace(myprice,",",".")
      myprice = replace(myprice,"-",",")
  else
    myprice = "0.00"
  end if
   

Regards Rohnny
     My Gambas Community http://gamasforum.tk


-- 
View this message in context: http://www.nabble.com/Can%27t-exec-an-sql-string-tf2494260.html#a6954599
Sent from the gambas-user mailing list archive at Nabble.com.





More information about the User mailing list