adataset := tmpquery;
result := tmpquery.recordcount > 0;
end;
{ tdataaccess }
function tdataaccess.getsqlvalue(asqlstr: string;
var avalue: variant): boolean;
var
tmpdataset: tdataset;
i: integer;
begin
result := opensql(asqlstr, tmpdataset);
try
if result then
begin
avalue := vararraycreate([0, tmpdataset.fieldcount], varvariant);
for i := 0 to tmpdataset.fieldcount - 1 do // iterate
begin
avalue[i] := tmpdataset.fields[i].asstring;
end; // for
end;
finally
tmpdataset.close;
tmpdataset.free;
end;
end;
function tdataaccess.getsqlvalue(asqlstr: string;
var avalue: string): boolean;
var
tmpdataset: tdataset;
begin
result := opensql(asqlstr, tmpdataset);
try
if result then
avalue := tmpdataset.fields[0].asstring;
finally
tmpdataset.close;
tmpdataset.free;
end;
end;