[Gambas-user] Problems with results from mysql
Rolf Schmidt
rolf.frogs at ...221...
Mon Apr 4 19:55:10 CEST 2005
Hi
I wrote a small application to collect my bicycle kilometers and show my
fitness. The time I sit on the bicycle is stored in seconds but I let MySQL
give me the sum in hours, minutes and scecons.
Here the query and the result as shown by the mysql-client:
select sec_to_time(sum(dauersekunden)) as dat ,
sum(kilometer) as km
from daten where datum between '2005-01-01' and '2005-12-31';
+----------+---------+
| dat | km |
----------+---------+
| 26:40:11 | 613.042 |
+----------+---------+
1 row in set (0.00 sec)
As one can see, the time is given in hours.
Gambas shows the result as: "01.01.-4801 01:30:11"
Here the gambas code:
request = "select sec_to_time(sum(dauersekunden)) as dat, sum(kilometer) " &
" as km from daten where datum between '"
request = request & Year(Now) & "-01-01' and '" & Year(Now) & "-12-31' "
myresult = hDB.Exec(request)
IF (abfrage.Count > 0) THEN
TextLabel1.text = "Duration: " & myresult["dat"] & " Std."
Textlabel2.text = "Length: " & myresult["km"] & " km"
ELSE
Textlabel1.visible = FALSE
TextLabel2.visible = FALSE
END IF
Even in the gambas debugger the value "01.01.-4801 01:30:11" is shown, So
where take the conversion place and how could I get the right values?
Bye
Rolf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20050404/7aef7c6a/attachment.sig>
More information about the User
mailing list