[Gambas-user] Money type in correct representation PT_BR

Fabricio Silva buxaman at ...626...
Mon Sep 11 16:09:32 CEST 2006


Hey Rohnny,

Tks for the fast reply but It's giving me the error: "Type mismatch: wanted
Stream, got Result instead".


2006/9/11, R. Stormo <rohnny at ...1248...>:
>
>
>
>
> Fabricio Silva-2 wrote:
> >
> > Helo,
> >
> > In Brazil the currency is displayed like this:  R$ 147,00   R$ 3.521,00
> > and
> > so on. I'm using SuSE 10.0, mysql 4.1 and Gambas 1.9.34. Before saving
> > data
> > I used: txtprice.Text = Replace$(txtprice.Text, ",", ".")  because I use
> a
> > decimal (7,2) data type. Now I'm trying to display it to the users using
> a
> > table view but I'm stuck in how to tell gambas only to change the
> correct
> > values. I tryed Format without sucess. There's another issue that I
> can't
> > figure out in this code of mine. There's some sort of loop messing up
> > things.... I inserted a:
> > PRINT (global.rs1[arrtable[Column]])
> > just before:
> > global.rs1.MoveTo(Row)
> > And saw it repeat the value many times. Why?
> >
> > Tanks in advance
> >
> > The code:
> >
> > ------------------------------------Product
> > Class-------------------------------------------
> >
> > arrtable[4] AS String
> > PUBLIC global AS principal
> > PUBLIC i AS String
> >
> > PUBLIC SUB form_open()
> >
> >   global = NEW principal
> >   global.conection()
> >   db.Close
> >   db.Open
> >
> >   show_data()
> >
> > END
> >
> > PUBLIC SUB show_data()
> > DIM sql AS String
> >   WITH tableview1
> >     .rows.count = 0
> >     .columns.count = 4
> >     .columns[0].text = "Code"
> >     .columns[0].Width = 50
> >     .columns[1].text = "Description"
> >     .columns[1].Width = 300
> >     .Columns[2].Text = "Quantity"
> >     .columns[2].Width = 80
> >     .columns[3].text = "Price"
> >     .columns[3].Width = 70
> >
> >   END WITH
> >   sql = "SELECT code, description, quantity, price FROM product ORDER BY
> > code ASC"
> >   global.fill(tableview1, sql)
> >
> > END
> >
> > PUBLIC SUB tableview1_Data(Row AS Integer, Column AS Integer)
> >
> >   arrtable[0] = "code"
> >   arrtable[1] = "description"
> >   arrtable[2] = "quantity"
> >   arrtable[3] = "price"
> >   global.rs1.MoveTo(Row)
> >   tableview1.data.Text = CStr(global.rs1[arrtable[Column]])
> >   'tableview1.data.Text = Format$(Val(global.rs1[arrtable[Column]]),
> > "#,00")
> >
> > END
> > --------------------------Relevant part of Principal
> > Class-------------------------------------------
> >
> > PUBLIC rs AS Result
> > PUBLIC rs1 AS Result
> > STATIC PUBLIC db AS NEW Connection
> > PUBLIC CONST dbname AS String = "geral"
> > PUBLIC CONST host AS String = "localhost"
> > PUBLIC CONST passw AS String = "teste"
> > PUBLIC CONST login AS String = "root"
> >
> > STATIC PUBLIC FUNCTION conection() AS Boolean
> >
> >   db.Type = "mysql"
> >   db.Host = host
> >   db.Login = login
> >   db.Password = passw
> >   db.Name = dbname
> >
> >   RETURN TRUE
> > CATCH
> >   RETURN FALSE
> >
> > END
> >
> > PUBLIC SUB fill(tbv AS tableview, qry AS String)
> > DIM i AS Float
> >   rs1 = db.exec(qry)
> >   WITH rs1
> >     tbv.rows.count = 0
> >     IF .count <> 0 THEN
> >       tbv.columns.count = .fields.count
> >       tbv.rows.count = .count
> >     END IF
> >   END WITH
> > END
> >
> -------------------------------------------------------------------------
> > Using Tomcat but need to do more? Need to support web services,
> security?
> > Get stuff done quickly with pre-integrated technology to make your job
> > easier
> > Download IBM WebSphere Application Server v.1.0.1 based on Apache
> Geronimo
> > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> > _______________________________________________
> > Gambas-user mailing list
> > Gambas-user at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/gambas-user
> >
> >
>
> Should it not be a rs1.movenext to get to the next record in the database?
>
>
> PUBLIC SUB fill(tbv AS tableview, qry AS String)
> DIM i AS Float
>   rs1 = db.exec(qry)
>   do while not EOF(rs1)
>     tbv.rows.count = 0
>     IF .count <> 0 THEN
>       tbv.columns.count = .fields.count
>       tbv.rows.count = .count
>     END IF
>
>    rs1.movenext
>
>   loop
> END
>
>
> Regards Rohnny
>       http://forum.stormweb.no
>
>
>
> --
> View this message in context:
> http://www.nabble.com/Money-type-in-correct-representation-PT_BR-tf2252299.html#a6246928
> Sent from the gambas-user forum at Nabble.com.
>
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job
> easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>



More information about the User mailing list