Page 1 of 1

mysql result , fileld etc

Posted: Tue 31 Jan 2006 17:22
by voodoo
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?!

Posted: Mon 06 Feb 2006 10:24
by Ikar
Please see MyDAC demos for example.

Posted: Mon 06 Feb 2006 10:47
by swierzbicki
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);