mysql result , fileld etc

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
voodoo
Posts: 1
Joined: Tue 31 Jan 2006 17:12

mysql result , fileld etc

Post by voodoo » Tue 31 Jan 2006 17:22

Hello,
i am trying to do a simple thing : select * from database where something=thing;

i want to use functions(in php) like mysql_fetch_assoc or mysql_fetch_row or mysql_fetch_array to manage the result of mysql query

for now i am trying(but is not what i really want) with
Label4.Caption := MyQuery1.Fields.Fields[2].AsString;
but gives me an error : "xxx" is not a valid floting point value.


can you give me an exemple how to manage the result of query?!

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Mon 06 Feb 2006 10:24

Please see MyDAC demos for example.

swierzbicki
Posts: 451
Joined: Wed 19 Jan 2005 09:59

Post by swierzbicki » Mon 06 Feb 2006 10:47

You have to know the Fied type type.
for now i am trying(but is not what i really want) with
Label4.Caption := MyQuery1.Fields.Fields[2].AsString;
but gives me an error : "xxx" is not a valid floting point value.
It looks like your Field[2] is a float type ( and not a String ).

You can either use variant (and don't have to bother of the field type), but this will slow down your project

Label4.Caption := vartostr(MyQuery1.Fields.Fields[2].Value);

or use the correct type

Label4.Caption := floattostr(MyQuery1.Fields.Fields[2].AsFloat);

Post Reply