you want, at its generically worst, but easiest to explain.<br><br>var<br> data:array of variant;<br><br>setlengh(data,query.fieldcount);<br>for i := 0 to query.fieldcount -1 do<br> data[i] := query.Field[i],asvariant;<br>
<br><div class="gmail_quote">On Fri, Feb 15, 2008 at 12:10 PM, Nick <<a href="mailto:nick@salehoo.com">nick@salehoo.com</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
o/ Good morning all :-)<br>
<br>
I just writing up a class for my database calls.<br>
One of the methods I am doing allows me to put in some sql and<br>
parameters and it spits back the row result (only ever be one)<br>
<br>
So if my component was, Query = TAdoQuery (or something similar), I am doing<br>
<br>
Query.Sql.text := somequery;<br>
//-- add in params<br>
Query.open;<br>
Query.first;<br>
<br>
Now I can do,<br>
result := Query.Fields[0].AsVariant;<br>
to get the first column, but I am after the whole row result. But Im<br>
not sure what class/type I would be using.<br>
I think, from looking at DB.pas source I would be using TFieldList?<br>
<br>
Effectively what I am after is like this<br>
<br>
<br>
var<br>
queryresult : TSomething?TFieldList?<br>
begin<br>
queryresult := db.fetchrow('SELECT id,name,phone FROM user WHERE id=1');<br>
showmessage(queryresult.fieldbyname('name'));<br>
end;<br>
<br>
follow what I mean?<br>
<br>
<br>
<br>
_______________________________________________<br>
NZ Borland Developers Group - Delphi mailing list<br>
Post: <a href="mailto:delphi@listserver.123.net.nz">delphi@listserver.123.net.nz</a><br>
Admin: <a href="http://delphi.org.nz/mailman/listinfo/delphi" target="_blank">http://delphi.org.nz/mailman/listinfo/delphi</a><br>
Unsubscribe: send an email to <a href="mailto:delphi-request@listserver.123.net.nz">delphi-request@listserver.123.net.nz</a> with Subject: unsubscribe<br>
</blockquote></div><br><br clear="all"><br>-- <br>Kyley Harris<br>Harris Software<br>+64-21-671-821