不可能你取出来的肯定是数据集
下面的仅供参考
function sqllookup(sql_str:string):variant;
begin
with dtmdl_main.ADOQryShare do
begin
close;
sql.clear;
sql.add(sql_str);
open;
end;
if dtmdl_main.ADOQryShare.RecordCount=0 then
begin
if dtmdl_main.ADOQryShare.Fields[0].datatype in [ftsmallint,ftinteger,ftfloat] then result:=0
else result:='';
end
else
begin
if dtmdl_main.ADOQryShare.Fields[0].IsNull then
begin
if dtmdl_main.ADOQryShare.Fields[0].datatype in [ftsmallint,ftinteger,ftfloat] then result:=0
else result:='';
end
else
result:=dtmdl_main.ADOQryShare.Fields[0].value;
end;
end;