Nick
You could create your own class (subclassing TList) or just use a TList
(for ease of destruction use a TObjectList?)
var
I: integer;
queryresult : TNicksQuery;
begin
try
queryresult := new TNicksQuery('SELECT id,name,phone FROM user WHERE
id=1');
for i := 0 to pred(queryresult.count) do begin
....
end
finally
freeandnil(queryresult )
end;
end;
HTH
I just writing up a class for my database calls.
One of the methods I am doing allows me to put in some sql and
parameters and it spits back the row result (only ever be one)
So if my component was, Query = TAdoQuery (or something similar), I am
doing
Query.Sql.text := somequery;
//-- add in params
Query.open;
Query.first;
Now I can do,
result := Query.Fields[0].AsVariant;
to get the first column, but I am after the whole row result. But Im
not sure what class/type I would be using.
I think, from looking at DB.pas source I would be using TFieldList?
Effectively what I am after is like this
var
queryresult : TSomething?TFieldList?
begin
queryresult := db.fetchrow('SELECT id,name,phone FROM user WHERE id=1');
showmessage(queryresult.fieldbyname('name'));
end;
follow what I mean?
_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: [email protected]
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to [EMAIL PROTECTED]
with Subject: unsubscribe
_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: [email protected]
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to [EMAIL PROTECTED] with Subject: unsubscribe