mysql result , fileld etc

mysql result , fileld etc

Postby 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?!
voodoo
 
Posts: 1
Joined: Tue 31 Jan 2006 17:12

Postby Ikar » Mon 06 Feb 2006 10:24

Please see MyDAC demos for example.
Ikar
 
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Postby 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);
swierzbicki
 
Posts: 451
Joined: Wed 19 Jan 2005 09:59


Return to MySQL Data Access Components